ld: duplicate symbol Gnuplot::SetLineStyles() in /MyFolder/UnitGnuplotInterface.o and /MyFolder/GnuplotInterfaceMain.o
IDE: Xcode 3.1.2
This might happen if you use my Gnuplot Interface. The cause is in the following lines:
//Yes, this #include is non-standard //But it enables you to compile-and-run //To do it correctly, add the file 'Gnuplot.cpp' to your project, //and #include 'Gnuplot.h' instead. #include "UnitGnuplotInterface.cpp"
Duplicate symbols occur when you have both added an implementation file (.cpp) to your project and #included it. This way, the implementation file (.cpp) gets compiled twice: once as a module in your project (as it is added to your project) and subsequently as a piece of #included code.
Avoid #including implementation files (.cpp). Prefer #including header files (.h) only. Prefer adding implementation files (.cpp) to your project.
For the Gnuplot Interface problem: follow the hints from the commments:
Thanks to Roger Wehage for sending me a complete and detailed email with this problem