Boost logo

Boost Users :

Subject: [Boost-users] Problems compiling on Windows......
From: Marcus MacWilliam (marcus.macwilliam_at_[hidden])
Date: 2013-07-23 09:36:15


Hello,

I am a boost newbie, and this is my first post :-)

I am inserting boost into my application using pre-compiled headers on
Windows.
The pre-compiled header looks like this:

#ifndef PRECOMPILEDHEADERS_WINRT_SRC_MAIN_INCLUDE_PRE_COMPILED_H_
#define PRECOMPILEDHEADERS_WINRT_SRC_MAIN_INCLUDE_PRE_COMPILED_H_

// Standard integer types
#include <stdint.h>

// Includes for d2d libraries
#include <wrl.h>
#include <d3d11_1.h>
#include <d2d1_1.h>
#include <d2d1effects.h>
#include <d2d1_1helper.h>
#include <dwrite_1.h>
#include <wincodec.h>
#include <math.h>
#include <agile.h>

// Includes for STL types
#include <string>
#include <vector>
#include <set>
#include <map>
#include <memory>
#include <exception>
#include <collection.h>

// Includes for Windows error
#include <winerror.h>

// Includes for Boost libraries
#include "boost/exception/all.hpp"
#include "boost/optional.hpp"
#include "boost/variant.hpp"
#include "boost/exception_ptr.hpp"
#include "boost/date_time/posix_time/posix_time_types.hpp"
#include "boost/archive/text_oarchive.hpp"
#include "boost/archive/text_iarchive.hpp"
#include "boost/serialization/access.hpp"
#include "boost/serialization/vector.hpp"
#include "boost/serialization/string.hpp"

// Includes for devices communications
#include "boost/interprocess/sync/named_mutex.hpp"
#include "boost/interprocess/sync/scoped_lock.hpp"
#include "boost/archive/binary_oarchive.hpp"
#include "boost/archive/binary_iarchive.hpp"

#endif // PRECOMPILEDHEADERS_WINRT_SRC_MAIN_INCLUDE_PRE_COMPILED_H_

However when I attempt to compile this through maven, using the
maven-nar-plugin, on a Windows 8 machine, I get the following error:

[INFO] --- maven-nar-plugin:2.25:nar-compile (default-nar-compile) @
precompiledheaders-winrt ---
[INFO] Compiling 1 native files
[INFO] Looking for WinRT dependencies
[ERROR]
C:\Users\marcusma\Source\1edit-prism\precompiledheaders\winrt\external-sources\boost/interprocess/detail/os_file
_functions.hpp(94) : error C2039: 'getenv' : is not a member of 'std'
[ERROR]
C:\Users\marcusma\Source\1edit-prism\precompiledheaders\winrt\external-sources\boost/interprocess/detail/os_file
_functions.hpp(94) : error C3861: 'getenv': identifier not found

This appears to be correct, getenv according to the MSDN documentation
is not available when compiling code for WinRT, using Visual Studio 12,
on a Windows 8 machine.

I understood that boost was supposed to be multi-platform, so why is
std::getenv being used, which is not available for Windows?

Can someone suggest what I need to do to get my pre-compiled headers to
compile.

Cheers,

-- 
Marcus A.T MacWilliam, Senior Software Engineer. 1Spatial Ltd.
Tel: +44 (0)1223 420414, ext 2289,    Mob: +44 (0)7803 706597.
E-Mail: marcus.macwilliam_at_[hidden] Skype:marcus.macwilliam
Tennyson House, 7 Cambridge Business Park, Cambridge, CB4 0WZ.
Registered in England No. 4785688,     VAT Reg. No. 135539408.
Website: http://www.1spatial.com/    E-mail: info_at_[hidden]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net