c++ - General techniques for debugging the "multiple definition of ..." error? -


i looking general debugging "tricks" finding source problem of kind of error message:

build/nat.cpp.o:(.bss+0x0): multiple definition of `input::hellocounter' build/sam.cpp.o:(.bss+0x0): first defined here collect2: error: ld returned 1 exit status 

here, input::hellocounter global variable defined in header file, header file well-guarded ifndef....

pasting source here should pointless there many. wondering whether have general techniques debugging in such situation, e.g., inserting special code expose issue? information, using ubuntu 14.04, clang/g++ compiler.

this implementation-specific issue. did not specify compiler or operating system using, no particular platform can offered. however, example, in similar situation on linux use nm(1) tool binutils search object code files ones define symbol, locating object code files define it, , determine ones should not have defined.

once it's known object code file's definition should not there, corresponding source file can examined determine how compiled way did.

i'm sure whatever compiler or operating system you're using, must have comparable tools can use in same way.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -