我正在尝试将 boost 库导入我的 C++ 项目,但出于某种原因它找不到 Boost.Process,尽管它找到了其他库。
我的 CMakeLists.txt 文件:
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
set (PROJECT_NAME "test-stuff" CXX)
project (${PROJECT_NAME})
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.64.0 REQUIRED system filesystem process)
if(Boost_FOUND)
include_directories (SYSTEM ${Boost_INCLUDE_DIR})
endif()
include_directories(include)
file(GLOB SOURCES "src/*.cpp")
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
错误的完整跟踪(使用调试设置):
The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1039 ] _boost_TEST_VERSIONS = 1.64.0;1.64
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1041 ] Boost_USE_MULTITHREADED = ON
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1043 ] Boost_USE_STATIC_LIBS =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1045 ] Boost_USE_STATIC_RUNTIME =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1047 ] Boost_ADDITIONAL_VERSIONS =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1049 ] Boost_NO_SYSTEM_PATHS =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1117 ] Declared as CMake or Environmental Variables:
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1119 ] BOOST_ROOT =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1121 ] BOOST_INCLUDEDIR =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1123 ] BOOST_LIBRARYDIR =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1125 ] _boost_TEST_VERSIONS = 1.64.0;1.64
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1200 ] Include debugging info:
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1202 ] _boost_INCLUDE_SEARCH_DIRS = PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1204 ] _boost_PATH_SUFFIXES = boost-1_64_0;boost_1_64_0;boost/boost-1_64_0;boost/boost_1_64_0;boost-1_64;boost_1_64;boost/boost-1_64;boost/boost_1_64
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1224 ] location of version.hpp: /usr/local/include/boost/version.hpp
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1248 ] version.hpp reveals boost 1.64.0
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1334 ] guessed _boost_COMPILER =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1344 ] _boost_MULTITHREADED = -mt
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1388 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1390 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1452 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/include/lib;/usr/local/include/../lib;/usr/local/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/include/lib;/usr/local/include/../lib;/usr/local/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1597 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-mt-1_64;boost_system-mt;boost_system
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ] Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1646 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-mt-d-1_64;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ] Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1597 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mt-1_64;boost_filesystem-mt;boost_filesystem
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ] Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1646 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-mt-d-1_64;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ] Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
CMake Warning at /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1566 (message):
No header defined for process; skipping header check
Call Stack (most recent call first):
CMakeLists.txt:19 (find_package)
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1597 ] Searching for PROCESS_LIBRARY_RELEASE: boost_process-mt-1_64;boost_process-mt;boost_process
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ] Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1646 ] Searching for PROCESS_LIBRARY_DEBUG: boost_process-mt-d-1_64;boost_process-mt-d;boost_process-mt;boost_process
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ] Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1719 ] Boost_FOUND = 1
CMake Error at /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1879 (message):
Unable to find the requested Boost libraries.
Boost version: 1.64.0
Boost include path: /usr/local/include
Could not find the following Boost libraries:
boost_process
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:19 (find_package)
我知道 Boost.Process 仅包含在 Boost 1.64 及更高版本中,但根据输出,我使用的是 Boost 1.64 和 Cmake 3.9。我查看了/usr/local/include/boost 并且 process.hpp 在那里。
感谢您的任何建议。
最佳答案
因此,在用头撞墙数小时后,我意识到我不需要使用 find_package 导入 Boost.Process,因为它是一个仅包含 header 的库 (argggg)。我删除了 CMakeList.txt 和 ta-dah 中的“进程”导入:它起作用了。
关于c++ - 找不到 boost_process cmake find_package,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45931450/
我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
如何将send与+=一起使用?a=20;a.send"+=",10undefinedmethod`+='for20:Fixnuma=20;a+=10=>30 最佳答案 恐怕你不能。+=不是方法,而是语法糖。参见http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html它说Incommonwithmanyotherlanguages,Rubyhasasyntacticshortcut:a=a+2maybewrittenasa+=2.你能做的最好的事情是:
我从Ubuntu服务器上的RVM转移到rbenv。当我使用RVM时,使用bundle没有问题。转移到rbenv后,我在Jenkins的执行shell中收到“找不到命令”错误。我内爆并删除了RVM,并从~/.bashrc'中删除了所有与RVM相关的行。使用后我仍然收到此错误:rvmimploderm~/.rvm-rfrm~/.rvmrcgeminstallbundlerecho'exportPATH="$HOME/.rbenv/bin:$PATH"'>>~/.bashrcecho'eval"$(rbenvinit-)"'>>~/.bashrc.~/.bashrcrbenvversions
我对如何计算通过{%assignvar=0%}赋值的变量加一完全感到困惑。这应该是最简单的任务。到目前为止,这是我尝试过的:{%assignamount=0%}{%forvariantinproduct.variants%}{%assignamount=amount+1%}{%endfor%}Amount:{{amount}}结果总是0。也许我忽略了一些明显的东西。也许有更好的方法。我想要存档的只是获取运行的迭代次数。 最佳答案 因为{{incrementamount}}将输出您的变量值并且不会影响{%assign%}定义的变量,我
我已经看到了一些其他的问题,尝试了他们的建议,但没有一个对我有用。我已经使用Rails大约一年了,刚刚开始一个新的Rails项目,突然遇到了问题。我卸载并尝试重新安装所有Ruby和Rails。Ruby很好,但Rails不行。当我输入railss时,我得到了can'tfindgemrailties。我当前的Ruby版本是ruby2.2.2p95(2015-04-13修订版50295)[x86_64-darwin15],尽管我一直在尝试通过rbenv设置ruby2.3.0。如果我尝试rails-v查看我正在运行的版本,我会得到同样的错误。我使用的是MacOSXElCapitan版本10
我花了几天时间尝试安装ruby1.9.2并让它与gems一起工作:-/我最终放弃了我的MacOSX10.6机器,下面是我的Ubuntu机器上的当前状态。任何建议将不胜感激!#rubytest.rb:29:in`require':nosuchfiletoload--mongo(LoadError)from:29:in`require'fromtest.rb:1:in`'#cattest.rbrequire'mongo'db=Mongo::Connection.new.db("mydb")#gemwhichmongo/usr/local/rvm/gems/ruby-1.9.2-p0/g
我正在尝试以一种更类似于普通RubyGem结构的方式构建我的Sinatra应用程序。我有以下文件树:.├──app.rb├──config.ru├──Gemfile├──Gemfile.lock├──helpers│ ├──dbconfig.rb│ ├──functions.rb│ └──init.rb├──hidden│ └──Rakefile├──lib│ ├──admin.rb│ ├──api.rb│ ├──indexer.rb│ ├──init.rb│ └──magnet.rb├──models│ ├──init.rb│ ├──invite.rb│ ├─
我正在尝试在SUSEEnterprise11SP3上安装compass。我得到以下信息。有什么想法吗?geminstallcompassBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingcompass:ERROR:Failedtobuildgemnativeextension./usr/bin/rubyextconf.rbmkmf.rbcan'tfindheaderfilesforrubyat/usr/lib64/ruby/ruby.hextconffailed,exitcode1Gemfileswi
我有一个数组数组,想将元素附加到子数组。+=做我想做的,但我想了解为什么push不做。我期望的行为(并与+=一起工作):b=Array.new(3,[])b[0]+=["apple"]b[1]+=["orange"]b[2]+=["frog"]b=>[["苹果"],["橙子"],["Frog"]]通过推送,我将推送的元素附加到每个子数组(为什么?):a=Array.new(3,[])a[0].push("apple")a[1].push("orange")a[2].push("frog")a=>[[“苹果”、“橙子”、“Frog”]、[“苹果”、“橙子”、“Frog”]、[“苹果”、“
有没有办法让Ruby能够做这样的事情?classPlane@moved=0@x=0defx+=(v)#thisiserror@x+=v@moved+=1enddefto_s"moved#{@moved}times,currentxis#{@x}"endendplane=Plane.newplane.x+=5plane.x+=10putsplane.to_s#moved2times,currentxis15 最佳答案 您不能在Ruby中覆盖复合赋值运算符。任务在内部处理。您应该覆盖+,而不是+=。plane.a+=b与plane.a=