my machine: Linux 5.16.0-3-amd64 #1 SMP PREEMPT Debian 5.16.11-1 (2022-02-25) x86_64 GNU/Linux
GNU Make 4.3
Make fails like this:
[ 7%] Building CXX object demo/CMakeFiles/c64mon.dir/main.cpp.o
[ 15%] Building C object demo/CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o
[ 23%] Building CXX object demo/CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o
[ 30%] Building CXX object demo/CMakeFiles/c64mon.dir/net.cpp.o
[ 38%] Building CXX object demo/CMakeFiles/c64mon.dir/prg.cpp.o
[ 46%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui.cpp.o
[ 53%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui_demo.cpp.o
[ 61%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui_draw.cpp.o
[ 69%] Building CXX object demo/CMakeFiles/c64mon.dir/__/imgui/imgui_tables.cpp.o
[ 76%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui_widgets.cpp.o
[ 84%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/backends/imgui_impl_sdl.cpp.o
[ 92%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/backends/imgui_impl_opengl2.cpp.o
[100%] Linking CXX executable c64mon
/usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o: in function main': CMakeCCompilerId.c:(.text+0x0): multiple definition ofmain'; CMakeFiles/c64mon.dir/main.cpp.o:main.cpp:(.text+0x1fd1): first defined here
/usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x0): multiple definition of info_compiler'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x0): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x8): multiple definition ofinfo_platform'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x8): first defined here
/usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x10): multiple definition of info_arch'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x10): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x18): multiple definition ofinfo_language_standard_default'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x18): first defined here
/usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x20): multiple definition of info_language_extensions_default'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x20): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: in functionmain':
CMakeCXXCompilerId.cpp:(.text+0x0): multiple definition of `main'; CMakeFiles/c64mon.dir/main.cpp.o:main.cpp:(.text+0x1fd1): first defined here
collect2: error: ld returned 1 exit status
make[2]: [demo/CMakeFiles/c64mon.dir/build.make:278: demo/c64mon] Fehler 1
make[1]: [CMakeFiles/Makefile2:98: demo/CMakeFiles/c64mon.dir/all] Fehler 2
make: *** [Makefile:91: all] Fehler 2
Hmmm, I suspect this might be an issue with SDL2main. In which directory relative to this project did you run cmake? As a quick potential fix, what happens when you rename the main function in main.cpp to SDL_main?
my machine: Linux 5.16.0-3-amd64 #1 SMP PREEMPT Debian 5.16.11-1 (2022-02-25) x86_64 GNU/Linux GNU Make 4.3
Make fails like this:
[ 7%] Building CXX object demo/CMakeFiles/c64mon.dir/main.cpp.o [ 15%] Building C object demo/CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o [ 23%] Building CXX object demo/CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o [ 30%] Building CXX object demo/CMakeFiles/c64mon.dir/net.cpp.o [ 38%] Building CXX object demo/CMakeFiles/c64mon.dir/prg.cpp.o [ 46%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui.cpp.o [ 53%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui_demo.cpp.o [ 61%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui_draw.cpp.o [ 69%] Building CXX object demo/CMakeFiles/c64mon.dir/__/imgui/imgui_tables.cpp.o [ 76%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/imgui_widgets.cpp.o [ 84%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/backends/imgui_impl_sdl.cpp.o [ 92%] Building CXX object demo/CMakeFiles/c64mon.dir//imgui/backends/imgui_impl_opengl2.cpp.o [100%] Linking CXX executable c64mon /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o: in function
main': CMakeCCompilerId.c:(.text+0x0): multiple definition of
main'; CMakeFiles/c64mon.dir/main.cpp.o:main.cpp:(.text+0x1fd1): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x0): multiple definition ofinfo_compiler'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x0): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x8): multiple definition of
info_platform'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x8): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x10): multiple definition ofinfo_arch'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x10): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x18): multiple definition of
info_language_standard_default'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x18): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x20): multiple definition ofinfo_language_extensions_default'; CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x20): first defined here /usr/bin/ld: CMakeFiles/c64mon.dir/CMakeFiles/3.25.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: in function
main': CMakeCXXCompilerId.cpp:(.text+0x0): multiple definition of `main'; CMakeFiles/c64mon.dir/main.cpp.o:main.cpp:(.text+0x1fd1): first defined here collect2: error: ld returned 1 exit status make[2]: [demo/CMakeFiles/c64mon.dir/build.make:278: demo/c64mon] Fehler 1 make[1]: [CMakeFiles/Makefile2:98: demo/CMakeFiles/c64mon.dir/all] Fehler 2 make: *** [Makefile:91: all] Fehler 2Hope you can help.