Reputation: 9056
I'm encountering this error while compiling some old VC++ 6.0 source code.
error C2632: 'long' followed by 'long' is illegal
There's a part of the code that declares a long long int variable which caused the error. Does anybody know how I can fix this error compiling it in VC++ 6.0? I've searched around and I've read that this data type is not yet supported in this version. However, this is an old code and I'm sure this was compiled in VC++ 6.0.
Upvotes: 2
Views: 10026
Reputation: 102296
error C2632: 'long' followed by 'long' is illegal
Microsoft finally added support for long long
and unsigned long long
at Visual Studio 2013.
Also see Which C99 features are available in the MS Visual Studio compiler?.
Does anybody know how I can fix this error compiling it in VC++ 6.0?
The problem also exists in the early .Net compilers, too. You have to use macros and Microsoft extensions to do it in a portable manner.
Here's how Crypto++ handles it (the project still supports old compilers to avoid forcing users to make unwanted choices):
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 word64;
#define W64LIT(x) x##ui64
#else
typedef unsigned long long word64;
#define W64LIT(x) x##ULL
#endif
You would then use it like so. It will work for VC++ 5.0/6.0, Visual Studio .Net, Visual Studio 2010, GCC, Clang, Intel, etc.
word64 x = W64LIT(0x0000000000000001);
Upvotes: 0
Reputation: 3423
I don't think VC6 supports the long long data type, but if you have the necessary typedefs already you could replace "long long" with "__int64" with a minimum of hassle.
Upvotes: 1
Reputation: 273536
AFAIK Visual C++ 6.0 only supports __int64
(Microsoft's own type definition for 64-bit integers). long long
is a standard type from C99, which 6.0 doesn't support.
Upvotes: 6