Boost logo

Boost Users :

Subject: Re: [Boost-users] \boost\cstdint.hpp(129) : error C2059: syntax error : '::'
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2014-03-05 09:13:57


2014-03-05 14:21 GMT+01:00 Uthpal Urubail <uthpal.urubail_at_[hidden]>:

> Thanks a lot Kris.
> I am not allowed to modify application file. Can you help me with
> the workaround?
> Regards,
> UJ
>

Ok, so you have a group of external headers that do evil things like
#define uint64_t. Here's what I do in cases like this.

//evil_prefix.h:
// Note: this file intentionally has no include guards.
#include "evil/a.h" // #defines uint64_t
#if !defined(uint64_t)
// these are the 3 offending lines copied from "evli/a.h":
#if defined(OS_WIN) && !defined(uint64_t)
#define uint64_t unsigned __int64
#endif
#endif // uint64_t

//evli_suffix.h:
// Note: this file intentionally has no include guards.
#undef uint64_t

Armed with the above two header files, in all your files _always_ include
all evil headers between the prefix and suffix includes:

#include "evil_prefix.h"
#include "evil/a.h"
#include "evil/b.h"
...
#include "evil_suffix.h"

If you follow the above rule, you can then include your files anywhere in
any order, and nothing should explode any more.

Regards,
Kris



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