Thanks
a lot, Chris. The build log looks like this:
====
ld: multiple definitions of symbol
TWCompositionsMgr::GetAllInstruments()
/Users/optimalsoft/SwarTools/build/SwarTools.build/SwarTools.build/Objects-normal/ppc/TWCompositionsMgr.o
definition of TWCompositionsMgr::GetAllInstruments() in section
(__TEXT,__text)
/Users/optimalsoft/SwarTools/build/SwarTools.build/SwarTools.build/Objects-normal/ppc/TWCompositionsMgr.o
definition of TWCompositionsMgr::GetAllInstruments() in section
(__TEXT,__text)
ld: multiple definitions of symbol
TWCompositionsMgr::GetCompositionBPM()
/Users/optimalsoft/SwarTools/build/SwarTools.build/SwarTools.build/Objects-normal/ppc/TWCompositionsMgr.o
definition of TWCompositionsMgr::GetCompositionBPM() in section
(__TEXT,__text)
/Users/optimalsoft/SwarTools/build/SwarTools.build/SwarTools.build/Objects-normal/ppc/TWCompositionsMgr.o
definition of TWCompositionsMgr::GetCompositionBPM() in section
(__TEXT,__text)
====
I have
only copied a few here, but I can send you the whole thing if needed (about
5000). But basically it's always the same pattern: each method is included twice
within the .o file. What could be the reason for that?
Cheers!
Mariano
On Jun 18, 2005, at 7:01 AM, Swar Systems wrote:
I am
porting some C++ code to OS X, and I am facing a sudden problem. Though the
code compiled well, linked successfully with ZeroLink option on (by
default), and ran quite well in debug mode, it suddenly stopped linking
after I made a few changes. Unchecking the ZeroLink option now shows me
about 5000 "multiple definitions of symbol" errors, even if I remove these
changes I had added.
That means that you have linking
errors. ZeroLink, true to its name, skips the linking step entirely, so things
like multiple and missing definitions are ignored. We recommend using ZeroLink
for debugging cycles, after your code is building
correctly.
These are
linkage errors. All sources build perfectly. I have also used "#ifndef"
statements on each header file to avoid including it more than once in each
.cpp.
Linking is a function of
libraries and frameworks only, not of headers.
Can
anyone help me by giving more details on when such an error is generated,
and how I can avoid
it?
Usually this is due to having extra, unnecessary libraries and/or
frameworks. You'd have to open the Build Results window, click the Transcript
button (looks like text), select the link errors in the build log, and copy
and paste the transcript text into an email message for us to diagnose.
Chris
|