Reputation: 10685
I'm trying to compile my code which had a faulty line. I have deleted that line but still the compilation fail because of some ghost:
/tmp/ccaWghvE.o: In function
show(lipid*)': membrane.cpp:(.text+0xf52): multiple definition of
show(lipid*)' /tmp/ccQicBxx.o:main.cpp:(.text+0x150): first defined here collect2: ld returned 1 exit status
How can I get rid of that?
Thanks
Solved
I have used ralu tip and created anew folder and copied everything into it. Thanks
Upvotes: 2
Views: 121
Reputation: 46617
You have a doubly defined symbol.
presumably you defined show(lipid*)
in a header file and included that header file from multiple translation units. To solve this issue, declare it inline
or move the definition (the actual code) to a cpp
file, retaining the declaration in the header file.
Upvotes: 1
Reputation: 96261
You defined show(lipid*)
both in main.cpp
and in membrane.cpp
. Either you have copies of the same function in both files or you have the function defined non-inline in a header they both include.
Upvotes: 8
Reputation: 22591
It says 'multiple definition'. You've defined something more than once. Make sure you only define it once!
Deleting the line the error is on rarely fixes the problem. That's often just the point the compiler realised something was wrong. You need to understand the error message, and correct the whole program, not just that line.
Upvotes: 1