Mechanized Assault & eXploration Reloaded

#1 Jul 09, 2019 7:16 pm
MickeyKnox Offline
Registered since: Nov 08, 2010
Posts: 8

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
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.
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= --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?
↑  ↓

#2 Jul 14, 2019 8:15 pm
Sal Sal Offline
, G-Mod
Registered since: Jun 07, 2004
Posts: 1,513

Subject: Re: Linker error during compilation
Hey, I asked in the discord channel for you
(here )

Alzi said, it looks like you are building without Exception handling/RTTI
It could be its missing compile flags

If you could
'make clean' and
'make VERBOSE=1'

and post the complete log here, we could know more.

Cheers =)

and thanks to alzi :*
- easy logic -
↑  ↓

#3 Jul 20, 2019 1:45 am
MickeyKnox Offline
Registered since: Nov 08, 2010
Posts: 8

Subject: Re: Linker error during compilation
Thanks for the invite, I've joined discord now.

I think the problem is that I tried to compile with GNU gcc and then link with Apples linker. That doesn't seem to work.
If you think that should work I will try again with VERBOSE=1 and post here.

I've been trying something different in the meantime: use Apples gcc. It simply seems to be more picky about forward declarations
with non-pointer variables. I could solve a few issues with just an #include, but in the case of chatcommand and chatcommandparser they
need each other. So I was thinking about refactoring that a little. I run make with -k and this seems to be the only issue left.
↑  ↓

Pages (1): 1

All times are GMT +01:00. Current time: 8:52 am.