我正在开发一个使用SFML的游戏。目前,该项目在目录“CMakeFiles”中使用CMakeCCCompilerId.c和CMakeFiles。
我在下面得到以下错误:
build/Debug/GNU-Linux-x86/_ext/305235777/CMakeCXXCompilerId.o:(.data+0x0): multiple definition of `info_compiler'
build/Debug/GNU-Linux-x86/_ext/1773982079/CMakeCCompilerId.o:(.data+0x0): first defined here
build/Debug/GNU-Linux-x86/_ext/305235777/CMakeCXXCompilerId.o:(.data+0x8): multiple definition of `info_platform'
build/Debug/GNU-Linux-x86/_ext/1773982079/CMakeCCompilerId.o:(.data+0x8): first defined here
build/Debug/GNU-Linux-x86/_ext/305235777/CMakeCXXCompilerId.o:(.data+0x10): multiple definition of `info_arch'
build/Debug/GNU-Linux-x86/_ext/1773982079/CMakeCCompilerId.o:(.data+0x10): first defined here
build/Debug/GNU-Linux-x86/_ext/305235777/CMakeCXXCompilerId.o: In function `main':
/home/rob/NetBeansProjects/development/projects/sfml- tmxloader/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp:368: multiple definition of `main'
build/Debug/GNU-Linux-x86/_ext/1773982079/CMakeCCompilerId.o:/home/rob/NetBeansProjects/development/projects/sfml-tmxloader/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c:378: first defined here
build/Debug/GNU-Linux-x86/_ext/581045564/Benchmark.o: In function `main':
/home/rob/NetBeansProjects/development/projects/sfml- tmxloader/examples/Benchmark.cpp:89: multiple definition of `main'
build/Debug/GNU-Linux-x86/_ext/1773982079/CMakeCCompilerId.o:/home/rob/NetBeansProjects/development/projects/sfml-tmxloader/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c:378: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/levelrender] Error 1
make[2]: Leaving directory `/home/rob/NetBeansProjects/development/projects/LevelRender'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/rob/NetBeansProjects/development/projects/LevelRender'
make: *** [.build-impl] Error 2
发布于 2022-02-09 10:49:21
同样的问题,通过将CXX
添加到:
project(project_name CXX)
https://stackoverflow.com/questions/28504754
复制相似问题