Question

I'm trying to compile a library on windows with mingw, that uses boost. I compiled boost with:

 bootstrap mingw
 b2 toolset=gcc 

After that I build the library with cmake and mingw. Building the dll itself works fine, but when I try to build the tests, I get:

C:/boost/boost_1_55_0/boost/test/utils/runtime/config.hpp:95:51: error: 'putenv'
 was not declared in this scope
 putenv( const_cast<char*>( fs.str().c_str() ) );

So the error comes from a boost header and I have no idea how to fix that.

The repo of what I'm trying to build: https://github.com/linges/daestruct

It uses c99 and c++11.

Was it helpful?

Solution

This seems to be a bug in boost. It has been happened to others, too:

https://github.com/BoostGSoC/boost.afio/commit/1b06855b6e20a01a3c4461c6d2d54e16eb3c8e21

The solution (or better: workaround) is to add the following lines before the inclusion of boost::test:

#ifdef __MINGW32__
// Mingw doesn't define putenv() needed by Boost.Test
extern int putenv(char*);
#endif
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top