Show whole topic Jul 09, 2019 7:16 pm
MickeyKnox Offline
Mitglied
Registered since: Nov 08, 2010
Location: -


Subject: Linker error during compilation
I was trying to compile maxr on my mac. Everything compiled fine until the linking stage:

$ make
[ 1%] Linking CXX executable maxr
Undefined symbols for architecture x86_64:
"std::runtime_error::what() const", referenced from:
cSavegame::loadSaveInfo(int) in savegame.cpp.o
cMenuControllerMultiplayerHost::startSavedGame() in menucontrollermultiplayerhost.cpp.o
cWindowSinglePlayer::loadGameClicked()::{lambda(cS
aveGameInfo const&)#1}::operator()(cSaveGameInfo const&) const in windowsingleplayer.cpp.o
...
tinyxml2::DynArray<tinyxml2::MemPoolT<104>::Block*, 10>::EnsureCapacity(int) in tinyxml2.cpp.o
tinyxml2::DynArray<tinyxml2::MemPoolT<72>::Block*, 10>::EnsureCapacity(int) in tinyxml2.cpp.o
"___dynamic_cast", referenced from:
cMouseCursorAmount::equal(cMouseCursor const&) const in mousecursoramount.cpp.o
cMouseCursorAttack::equal(cMouseCursor const&) const in mousecursorattack.cpp.o
cMouseCursorSimple::equal(cMouseCursor const&) const in mousecursorsimple.cpp.o
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in connectionmanager.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in dedicatedserver.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in drawingcache.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in eventmanager.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in extendedtinyxml.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in base.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in gamesettings.cpp.o
...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [maxr] Error 1
make[1]: *** [CMakeFiles/maxr.dir/all] Error 2
make: *** [all] Error 2

I'm using gcc-9:

$ gcc-9 -v
Using built-in specs.
COLLECT_GCC=gcc-9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/9.1.0/libexec/gcc/x86_64-apple-darwin18/9.1.0/lto-wrapper
Target: x86_64-apple-darwin18
Configured with: ../configure --build=x86_64-apple-darwin18 --prefix=/usr/local/Cellar/gcc/9.1.0 --libdir=/usr/local/Cellar/gcc/9.1.0/lib/gcc/9 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-9 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 9.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
gcc version 9.1.0 (Homebrew GCC 9.1.0)

Why is this happening? What can I do about it?