开发者

Processes in boost

开发者 https://www.devze.com 2023-01-26 13:11 出处:网络
I\'m using boost.process (additional lib for boost). At the page I gave for the link you can find samples of usage. I installed library, add: #include <boost/process.hpp> an开发者_如何学Cd some

I'm using boost.process (additional lib for boost). At the page I gave for the link you can find samples of usage. I installed library, add: #include <boost/process.hpp> an开发者_如何学Cd some following code:

namespace bp = ::boost::processes; // In samples the namespace name is process!
bp::command_line temp("ls");

error: ‘command_line’ is not a member of ‘bp’

And I have such errors for all described samples. What's wrong?


I know that real namespace should be process, but I looked into the code and found that it's wrapped with boost and then processes namespaces. So there aren't any process namespace.


Are you not maybe using a different/older/alternate version of boost process i.e. did you get boost process from the sandbox recently? If you open up boost/process.hpp do you see the following at the top?

// Copyright (c) 2006, 2007 Julio M. Merino Vidal // Copyright (c) 2008, 2009 Boris Schaeling

I recall that there was another version of boost process by another author available in the past.

I had a look at some of the process files by Vidal/Schaeling and they definitely all use the boost::process namespace. If you do not see that in the source, you are prob using another version. Also, I did not see any entries for command_line in the reference available at http://www.highscore.de/boost/process/. FYI, boost process also went through numerous changes recently (following discussions on the boost mailing list).


Well, as you say it yourself, the namespace from the samples is ::boost::process. The line :

namespace bp = ::boost::processes

only defines a namespace alias : bp:: is an alias for boost::processes. Writing bp::command_line is exactly like writing boost::processes::command_line. As command_line resides in the boost::process namespace, the type is not found.

0

精彩评论

暂无评论...
验证码 换一张
取 消