duplicate-symbol

Strange ld error

I have a project consisting of two files, main.c and logoff.c. When I try to compile them I get this error: gcc -c -g -Wall main.c gcc -c -g -Wall logoff.c gcc -o main -g -Wall main.o logoff.o ld: duplicate symbol _logoff in logoff.o and main.o I have a function named logoff in logoff.c, but I have searched main.c for the text "logoff...

C++ Duplicate Symbol error when defining static class variable in XCode

I have a static class member incremented in the constructor. As per the rules, it is declared in the class and defined outside. This should be totally legal. Any ideas why I'm getting a duplicate symbol error? class Player { private: static int numPlayers; public: Player() { numPlayers++; } }; int Player::numPlayers =...

How can I avoid "duplicate symbol" errors in xcode with shared static libraries?

I have static libraries A, B and C organized into Xcode projects. A and B depend on C. When I build an iPhone project that depends on A and B, I get a linker error that a duplicate symbol (from C) was detected in A and B. How can I organize these three static libraries so I can include them in other Xcode projects without experiencing...

Linker error with Duplicated Symbols, SWIG and C++ Vectors

I came across this error trying to compile a shared object from 2 sets of objects. The first set contains one .os object compiled from one cpp file generated by SWIG. The second set is contains all of the .so files from the individual files that make up the interface to be wrapped. $g++ -shared *.os -o Mathlibmodule.so ld: duplicate...