不能使用Boost.process [英] Cannot use Boost.process
问题描述
我下载和upack提升的1.54.0版本的库。我在回答这个问题所做的一切,如:如何使用升压在Visual Studio 2010中
然后我下载并解压这里Boost.process: http://www.highscore.de/boost/process/ 和所做的一切都是在为这个问题的答案:如何编译Boost.Process库一>
I download and upack Boost library version of 1.54.0. I did everything like in answer to this question: How to use Boost in Visual Studio 2010 Then I download and unpack Boost.process from here: http://www.highscore.de/boost/process/ and did everything as in answer to this question: How to compile Boost.Process library? .
我把持有人的过程,并在process.hpp持有提振,把其他持有人的过程中库和试图用b2.exe编译它,并用--with-进程bjam.exe,但得到错误的库名称'的过程。
I put holder process and process.hpp in holder boost, put other holder process in to libs and was trying to compile it with b2.exe and bjam.exe with "--with-process", but get "wrong library name 'process'.
不管结果如何,我包括图书馆到我的项目,并把这个code:
Whatever, I include library into my project and put this code:
namespace bp = ::boost::process;
int main()
{
std::string exec = "G:\\Detect.exe";
std::vector<std::string> args;
args.push_back("--version");
bp::context ctx;
ctx.stdout_behavior = bp::silence_stream();
bp::child c = bp::launch(exec, args, ctx);
return 0;
}
当我运行它,我得到了一些错误:
When I run it I get some errors:
1>c:\boost_1_54_0\boost\process\detail\pipe.hpp(129): error C2665: 'boost::system::system_error::system_error' : none of the 7 overloads could convert all the argument types
1> c:\boost_1_54_0\boost\system\system_error.hpp(39): could be 'boost::system::system_error::system_error(int,const boost::system::error_category &,const std::string &)'
1> c:\boost_1_54_0\boost\system\system_error.hpp(43): or 'boost::system::system_error::system_error(int,const boost::system::error_category &,const char *)'
1> while trying to match the argument list '(DWORD, overloaded-function, const char [54])'
1>c:\boost_1_54_0\boost\process\operations.hpp(130): error C2039: 'filesystem_error' : is not a member of 'boost::filesystem'
1>c:\boost_1_54_0\boost\process\operations.hpp(130): error C3861: 'filesystem_error': identifier not found
我应该怎么办?
推荐答案
我有类似的情况。结果
我从<下载的href=\"https://svn.boost.org/svn/boost/sandbox/process/\">https://svn.boost.org/svn/boost/sandbox/process/非官方Boost.Process库(改版机86799称该网站),并与升压1.55用过它。然后,只需把升压里面的头包括文件夹(我没有看到任何* .cpp文件,这样的lib似乎完全内嵌)。什么被发现了:
I downloaded from https://svn.boost.org/svn/boost/sandbox/process/ the non-official Boost.Process library (revision 86799 says the site) and used it with Boost 1.55. Then just put the headers inside the Boost include folder (I did not see any *.cpp files, so the lib seems completely inline). What was discovered:
-
/process/operations.hpp(130):filesystem_error'不是提高文件系统的::成员结果
把operations.hpp文件中的#include&LT;升压/ filesystem.hpp&GT;
/process/detail/pipe.hpp(129):的boost ::系统:: SYSTEM_ERROR :: SYSTEM_ERROR结果
追加到的boost ::系统:: system_category
函数调用,即它会成为的boost ::系统:: system_category()
。
/process/detail/pipe.hpp(129): 'boost::system::system_error::system_error'
Append to the boost::system::system_category
a function invocation i.e. it will become boost::system::system_category()
.
/process/detail/win32_ops.hpp(329):左'.size'必须有类/结构/联合结果
基本上模板是为const char *
,但实现的功能,因为它是的std ::字符串
。因此,我只是在功能,code的开始添加像的std :: string的exe文件(EXE _);
(即 exe文件_ 是在为const char *
参数)的新名称。也许不是最好的解决办法,但是足够我想好了。
/process/detail/win32_ops.hpp(329): left of '.size' must have class/struct/union
Basically the template is const char*
, but the function is implemented as it is std::string
. Thus I just added at the beginning of the function, code like std::string exe (exe_);
(the exe_ is the new name of the const char*
argument). Maybe not the best solution, but good enough I think.
希望这有助于。
这篇关于不能使用Boost.process的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!