2014-10-07 25 views
0

雖然在我的代碼實現的CMake我得到一個食人魔錯誤:食人魔錯誤在CMake的

/usr/bin/ld: cannot find -lOGRE 

我的CMakeLists.txt文件看起來像:

#Specify the version being used aswell as the language 
cmake_minimum_required(VERSION 2.6) 

#Name your project here 
project(eCAD) 

#sets cmake to run moc when needed 
set(CMAKE_AUTOMOC ON) 

#find requirements of this projects 
find_package(Qt5Widgets) 
find_package(Qt5Core) 
find_package(OGRE) 
find_package(OIS) 
# Find includes in corresponding build directories 
set(CMAKE_INCLUDE_CURRENT_DIR ON) 

#Sends the -std=c++11 flag to the gcc compiler 
add_definitions(-std=c++11) 

qt5_wrap_ui(Cmake_form_hdr resources/ui/mainwindow.ui) 

#This tells CMake to main.cpp and name it eCAD 
add_executable(eCAD main.cpp ${Cmake_form_hdr}) 

#include the subdirectory containing our libs 
add_subdirectory (gui) 
include_directories(gui) 

#link_libraries 
target_link_libraries(eCAD Qt5::Widgets Qt5::Core OGRE OIS) 

我是新來這個。請幫我解決問題

回答

1

命令find_package(OGRE)運行文件FindOGRE.cmake並設置變量OGRE_INCLUDE_DIRSOGRE_LIBRARIES。要鏈接到OGRE庫,您應該使用這些變量,例如

target_include_directories(eCAD PRIVATE ${OGRE_INCLUDE_DIRS}) target_link_libraries(eCAD ${OGRE_LIBRARIES})

這是同爲你使用外部庫。

+0

即使添加此錯誤仍然相同。 – user3859872 2014-10-07 08:06:41

+0

什麼給你'MESSAGE($ {OGRE_LIBRARIES})'? – Peter 2014-10-07 08:13:06

+0

使用該錯誤:使用錯誤的參數號碼調用 – user3859872 2014-10-07 08:27:05