slajerek / RetroDebugger

Retro Debugger is a multiplatform debugger APIs host for retro computers: C64 (Vice), Atari800 and NES (NestopiaUE).
175 stars 20 forks source link

Linux Linking error: undefined reference to IMPlot::BustItemCache() #13

Closed 3vi1 closed 1 year ago

3vi1 commented 1 year ago

Tested on Ubuntu Mantic (23.10 alpha): libMTEngineSDL.a makes & compiles fine, and RetroDebugger makes and compiles... until it gets to the linking step, where I receive the following error:

[100%] Linking CXX executable retrodebugger
/usr/bin/ld: /home/evil/src/RetroDebugger/../MTEngineSDL/build/libMTEngineSDL.a(implot.cpp.o): in function `ImPlot::ShowColormapSelector(char const*)':
/home/evil/src/MTEngineSDL/src/Engine/Libs/implot/implot.cpp:4755: undefined reference to `ImPlot::BustItemCache()'
/usr/bin/ld: /home/evil/src/RetroDebugger/../MTEngineSDL/build/libMTEngineSDL.a(implot.cpp.o): in function `ImPlot::ShowStyleEditor(ImPlotStyle*)':
/home/evil/src/MTEngineSDL/src/Engine/Libs/implot/implot.cpp:4890: undefined reference to `ImPlot::BustItemCache()'
/usr/bin/ld: /home/evil/src/MTEngineSDL/src/Engine/Libs/implot/implot.cpp:4897: undefined reference to `ImPlot::BustItemCache()'
/usr/bin/ld: /home/evil/src/MTEngineSDL/src/Engine/Libs/implot/implot.cpp:4903: undefined reference to `ImPlot::BustItemCache()'
/usr/bin/ld: /home/evil/src/MTEngineSDL/src/Engine/Libs/implot/implot.cpp:4950: undefined reference to `ImPlot::BustItemCache()'
/usr/bin/ld: /home/evil/src/RetroDebugger/../MTEngineSDL/build/libMTEngineSDL.a(implot.cpp.o):/home/evil/src/MTEngineSDL/src/Engine/Libs/implot/implot.cpp:4963: more undefined references to `ImPlot::BustItemCache()' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/retrodebugger.dir/build.make:2923: retrodebugger] Error 1
make[1]: *** [CMakeFiles/Makefile2:198: CMakeFiles/retrodebugger.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I'm not immediately sure why it would claim it's undefined, when I do see it in the implot_internal.h file included by implot.cpp.

3vi1 commented 1 year ago

Not sure if it's the correct fix, but I got past this problem by inserting this at line 267 of libMTEngineSDL's CMakeLists.txt:

"${CMAKE_CURRENT_SOURCE_DIR}/./src/Engine/Libs/implot/implot_items.cpp"

That seems to have caused it to include the correct definitions.

slajerek commented 1 year ago

True, forgot to copy the new CMakeLists.txt, thanks for spotting.

slajerek commented 1 year ago

Fixed by this: https://github.com/slajerek/MTEngineSDL/issues/5