【发布时间】:2015-02-13 16:58:28
【问题描述】:
我正在开发一个使用 SFML 的游戏。目前该项目在“CMakeFiles”目录中使用 CMakeCCCompilerId.c 和 CMakeCXXCompilerId.cpp
我收到以下错误:
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
【问题讨论】:
-
我怀疑您只想使用这两个文件中的一个,但更有可能您是在源目录中构建/配置,并在我链接的另一个问题中使用 glob。 @Mike Seymour,这些文件是由 CMake 创建的,因此 OP 无法编辑它们,或者将它们放在标题中。我有许多使用
project(... C CXX)并混合语言的CMake 系统。关键在树外
标签: c++ c compiler-errors makefile cmake