我正在使用带有 CMake (2.8.7) 和 gcc 4.6.3 的 Qt creator 2.5,最近我遇到了这个奇怪的错误:
:-1: 错误:[CMakeFiles/yahtzee.dir/gamecontroller.cpp.o] 错误 1 找不到文件
我能做些什么呢?CMake 没有生成这个gamecontroller.cpp.o
这是我的CMakeLists.txt
文件
project(cpp_workshop)
cmake_minimum_required(VERSION 2.6)
# Set default compile flags for GCC
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall -Wextra -Werror")
else()
message(STATUS "GCC not detected, probably running Windows")
endif(CMAKE_COMPILER_IS_GNUCXX)
#add_definitions("-Wall -Werror")
ADD_DEFINITIONS("-Wno-unused-parameter")
add_executable(yahtzee #name of the executable
gamecontroller.h gamecontroller.cpp
player.h player.cpp
game.h game.cpp
dice.h dice.cpp
strategy.cpp strategy.h
istrategy.h
game_rules.h
main singleton
)
顺便提一下,所有这些文件都位于目录中,这是 CMake 创建的“构建”目录:
CMakeCache.txt CMakeFiles cmake_install.cmake cpp_workshop.cbp Makefile
和上面的CMakeFiles
目录
CMakeCCompiler.cmake CMakeDirectoryInformation.cmake CompilerIdCXX TargetDirectories.txt
cmake.check_cache CMakeOutput.log Makefile2 yahtzee.dir
CMakeCXXCompiler.cmake CMakeSystem.cmake Makefile.cmake
CMakeDetermineCompilerABI_C.bin CMakeTmp Progress
CMakeDetermineCompilerABI_CXX.bin CompilerIdC progress.marks