Bernd Jendrissek-2 wrote > On Thu, Jan 15, 2015 at 2:11 AM, emkessler < > ldgn86a@ > > wrote: > (2) How can that happen when the symbol is obviously defined? > > It could happen if both source files are compiled into libraries, and > the library order doesn't allow one to see definitions in the other. > On Unixy platforms, libraries don't see "backward" up the link line. > For example, if your final link is something like > > gcc program.o -lmap -lunits > > then if your variable is defined in libmap, and libunits uses it, it > can't resolve the reference. To fix this sort of problem, invert the > order or libraries, or if it's a circular dependency, repeat the > earlier library after the one that uses symbols defined in it. In my > example, program.o can use any symbols defined in libmap or libunits, > and libmap can use any symbols in libunits, but libunits canot use > symbols from libmap. They're not in different libraries, but they are in different object files, so I tried rearranging the order of the object files in the final link. Now I get the following error: FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x0): multiple definition of `WriteToLogFile(wchar_t const*)@4' FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x0): first defined here FluxWarrior2D.o is the first object file in the link order. In the source code, WriteToLogFile() is only defined once. This error occurs perhaps fifty or a hundred times (I didn't count) for every global function, I believe. For example: FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x27f): multiple definition of `WinMain(HINSTANCE__*, HINSTANCE__*, wchar_t*, int)@16' FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x27f): first defined here FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x79f): multiple definition of `MyRegisterClass(HINSTANCE__*)' FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x79f): first defined here FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x83c): multiple definition of `InitInstance(HINSTANCE__*, CFluxWar2DScene*, CFluxWar2DView*&, int)' FluxWarrior2D.o:FluxWarrior2D.cpp:(.text+0x83c): first defined here In each case the "multiple definition" has the same address as the "first defined here." On the face of it this makes no sense, but there is probably a simple fix. What can I do here to fix this? -- View this message in context: http://gcc.1065356.n5.nabble.com/Is-undefined-reference-the-same-as-unresolved-external-symbol-tp1110017p1111008.html Sent from the gcc - Help mailing list archive at Nabble.com.