Boost 成功生成增压,但可以';无法生成生成文件。我哪里出错了?
尽管CMake已经成功地使用Boost配置并生成了makefile,但我无法使用如下所示的make命令为ARM处理器生成可执行文件 以下是我的配置设置: 1.)我在这个链接中下载了用Raspberry Pi编译的boost library 1.49: 2.)文件层次结构如下所示:Boost 成功生成增压,但可以';无法生成生成文件。我哪里出错了?,boost,cygwin,cmake,cross-compiling,Boost,Cygwin,Cmake,Cross Compiling,尽管CMake已经成功地使用Boost配置并生成了makefile,但我无法使用如下所示的make命令为ARM处理器生成可执行文件 以下是我的配置设置: 1.)我在这个链接中下载了用Raspberry Pi编译的boost library 1.49: 2.)文件层次结构如下所示: sample-boost -> boost-stage (Contains the lib, and include directories of the boost taken from number
sample-boost
-> boost-stage (Contains the lib, and include directories of the boost taken from number 1)
-> build (Contains the generated files from CMake)
-> CMakeLists.txt
-> main.cpp
注意:ARM交叉编译器正在全面运行,我已经在Cygwin中使用CMake(使用位于C:/Cygwin/ARM Pi.toolchain.CMake中的交叉工具链文件)交叉编译了一个hello world并在Raspberry Pi中成功运行了它
#include <iostream>
#include <boost/thread.hpp>
int main(){
cout << "Hello" << endl;
boost::this_thread::sleep(boost::posix_time::millisec(20));
return 0;
}
message("Boost LIBRARIES:" ${Boost_LIBRARIES})
是否显示库文件
另外:我照你的要求做了。这是我的新cmakelists.txt
cmake_minimum_required(VERSION 2.8)
Project(main)
SET(Boost_INCLUDE_DIR C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include)
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include")
SET(BOOST_ROOT C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage)
SET(Boost_USE_STATIC_LIBS TRUE)
SET(Boost_DEBUG ON)
#FIND_PACKAGE(Boost)
FIND_PACKAGE(Boost COMPONENTS thread)
message("BOOST LIBRARY: " ${Boost_LIBRARY_DIRS})
message("Boost LIBRARIES: " ${Boost_LIBRARIES})
message("LIBS : " ${LIBS})
IF(Boost_FOUND)
message("Boost include directory is found")
message("Boost_INCLUDE_DIRS: "${Boost_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
add_executable(main main.cpp)
target_link_libraries( main ${Boost_LIBRARIES} )
ENDIF(Boost_FOUND)
以下是输出控制台:
要在CMake中使用boost线程模块,您必须执行以下操作
find(Boost COMPONENTS thread)
通常,这会在
boost\u库中添加boost线程库的路径。
var.我将find\u包(boost)替换为find\u包(boost组件线程)。它说它再也找不到boost了。您可以将boost\u DEBUG
设置为ON以启用FindBoost的调试输出。我按您的要求做了。我真的不知道问题出在哪里。它似乎能够扫描boost线程库,但仍然报告没有找到boost,也没有找到boost库。另外,我不知道启用use_static_libsSee for have help on findBoost的效果。我认为您必须使用BOOST\u INCLUDEDIR
、BOOST\u LIBRARYDIR
和BOOST\u NO\u SYSTEM\u路径
var。如果找到库,则在显示BOOST\u LIBRARIES var时会列出库文件?另外,Linux中是否没有调试和发布库?
cmake_minimum_required(VERSION 2.8)
Project(main)
SET(Boost_INCLUDE_DIR C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include)
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include")
SET(BOOST_ROOT C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage)
SET(Boost_USE_STATIC_LIBS TRUE)
SET(Boost_DEBUG ON)
#FIND_PACKAGE(Boost)
FIND_PACKAGE(Boost COMPONENTS thread)
message("BOOST LIBRARY: " ${Boost_LIBRARY_DIRS})
message("Boost LIBRARIES: " ${Boost_LIBRARIES})
message("LIBS : " ${LIBS})
IF(Boost_FOUND)
message("Boost include directory is found")
message("Boost_INCLUDE_DIRS: "${Boost_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
add_executable(main main.cpp)
target_link_libraries( main ${Boost_LIBRARIES} )
ENDIF(Boost_FOUND)
find(Boost COMPONENTS thread)