Joe Staines
Joe Staines

Reputation: 321

boost::process cannot compile because of boost::throw_exception

When trying to include the boost::process library i get 2 errors relating to boost::process pipe.hpp file with the way it is handling exceptions.

'<function-style-cast>': cannot convert from 'initializer list' to 'boost::system::system_error' | pipe.hpp | line 129
'boost::throw_exception': no matching overloaded function found | pipe.hpp | line 129

Here is the offending line in boost::process pipe.hpp:

boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: CreatePipe failed")); 

I assume this has something to do with how boost may have changed how it handles exceptions and boost::process not updating to support that, however i'm not familiar with how boost has changed. The whole pipe.hpp file throws exceptions like this but they dont show up in the errors as they are behind define guards that have not been defined.

Upvotes: 1

Views: 410

Answers (2)

arturx64
arturx64

Reputation: 953

You can rebuild your project with Exception support. Add compile flag /EHsc or /EHa or /EHs

Upvotes: 1

MarkusParker
MarkusParker

Reputation: 1596

Use boost::system::system_category() instead of boost::system::system_category. Note that the latter may have worked in older boost versions. See here.

Upvotes: 4

Related Questions