5

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? .

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'.

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

What should I do?

Community
  • 1
  • 1
Il'ya Zhenin
  • 1,272
  • 2
  • 20
  • 31
  • 3
    It seems that the documentation is not quite up to date, and presumably the examples as well. You have to remember that Boost Process is not yet an official part of Boost, and so can still be heavily under development and contain code-breaking changes. – Some programmer dude Nov 11 '13 at 13:49
  • Fine...So I can try earlier version of boost? – Il'ya Zhenin Nov 11 '13 at 14:05

2 Answers2

10

I had similar situation.

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' is not a member of boost::filesystem
    Put inside the operations.hpp file #include <boost/filesystem.hpp>

  • /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): 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.

Hope this helps.

Rado
  • 766
  • 7
  • 14
5

Il'ya Zhenin, In pipe.hpp, where ever you are using "boost::system::system_category" replace it with boost::system::system_category(). This will resolve the system_error issue.

For fixing filesystem_error issue, add #include <boost/filesystem.hpp> in the operations.hpp header section. I hope this helps.

FAISAL
  • 33,618
  • 10
  • 97
  • 105