Boost logo

Boost Users :

Subject: Re: [Boost-users] Problems compiling on Windows......
From: Pekka Seppänen (pekka.seppanen_at_[hidden])
Date: 2013-07-23 10:41:34


On 23.7.2013 16:36, Marcus MacWilliam wrote:
> 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.

Yes, that is true.

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

Umm, you're planning to use an embedded like / limited set API from where MS
has decided to drop support for environment variables. It's not like you're
building for a "regular" Windows PC desktop that has been around for a while.

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

Now. You're facing a situation where you're asking for a feature that simply
isn't available on your platform. You could whine to your OS vendor (unlikely
anything will happen), change your platform (not gonna happen says the
management), or:

Perheaps even care to open the file where the error arises. When you look at
line 92:

inline const char *get_temporary_path()
{ return std::getenv("TMP"); }

Ooh! It tries to find a temporary path, how sweet! Then you start asking
yourself questions like: Could you drop your own getenv() under std? From
where is this function called? Are you're trying to use a feature set that
isn't available on your platform? Perhaps even accidentally including a header
that you don't even need? Etc.

If you're upset with having to drop a (dirty) hack everytime you upgrade to a
new version, you could also patch the actual file! "Don't supply
get_temporary_path() and anything that depends on it when compiling for WinRT
because it simply isn't there!".

Then you look how this kind of thing "on platform X do Y" is done elsewhere in
the library. Dive well into headers. Smash your head against the wall for a
while. Craft some code. Smile.

You test it, if it works and you're happy with it, you create a Trac ticket,
send your patch in, sit back and relax. Then everyone else can share the joy
of building Boost on WinRT, too. Or on any other new platform that currently
doesn't work due to small things like this.

And that's you help to build a library that everyone can use for free, for any
purpose, on pretty much any common platform.

-- Pekka


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