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 06:25:56


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

> I am trying use boost in my application. I am getting compiler error, if I
> try to include headers after one of the application include file where
> uint64_t is defined.
>
> #if defined(OS_WIN) && !defined(uint64_t)
> #define uint64_t unsigned __int64
> #endif
>
> Error:
>
[...]

> Can some one help me find the better solution to resolve these type of
> issues?
>
> Regards,
> UJ
>

Hi Uthpal,

Are you allowed to modify the application file? It is generally a bad idea
to #define identifiers, that can likely be used in other header files.

So, the preferred solution is to modify that application header. Instead of:
#define uint64_t unsigned __int64
try:
typedef unsigned __int64 uint64_t;

Or better yet, just use #include <stdint.h> or <cstdint> if they are
available, because they provide the typedef uint64_t and alike.

On the other hand, if you are not allowed to modify the offending
application file, then you'll need some trickery to work around this. I can
elaborate on this if you need it.

HTH,
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