简而言之:
alt text http://www.uni-koblenz.de/~aheld/Cmake%20wears%20very%20dark%20sunglasses.png
为了加重伤害,CMake实际上跑了好几次。当CMake突然感觉不再工作时,我正在努力解决编译器错误。作为参考,这是整个CMakeLists.txt文件:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
Find_Package ( SDL REQUIRED )
Find_Package ( SDL_image REQUIRED )
Find_Package ( SDL_mixer REQUIRED )
if ( NOT SDL_FOUND )
message ( FATAL_ERROR "Make sure that SDL is installed" )
endif ( NOT SDL_FOUND )
link_libraries (
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
${SDLMIXER_LIBRARY}
SDLmain
)
set(wiggle_SOURCES
level.cpp
levelgenerator.cpp
main.cpp
player.cpp
scoreboard.cpp
snake.cpp
soundplayer.cpp
titlescreen.cpp
)
add_executable(Wiggle ../${wiggle_SOURCES})
第一次出现错误,而不是简单地输入“make”,我输入“make -lSDL -lSDL_image -lSDL_mixer” - 在我分离后,拒绝找到头文件SDL.h和SDL_image.h来自Code :: Blocks的项目。
答案 0 :(得分:4)
这一行:
add_executable(Wiggle ../${wiggle_SOURCES})
将扩展为:
add_executable(Wiggle ../level.cpp levelgenerator.cpp main.cpp etc)
这可能不是你想要的。另外,我认为您的level.cpp
文件不在父目录中,是吗?