|
-
December 5th, 2010, 07:57 AM
#1
long long data type
I am trying to compile third party c code in Visual C++ (10 years old).
Long long data type is used extensively (thousands of times).
Example: PrintLongInteger(void *,char *,long long);
I get this error message: 'long' followed by 'long' is illegal
What is the best way to solve this problem?
-
December 5th, 2010, 09:59 AM
#2
Re: long long data type
I tried:
#define long long __int64
and
typedef __int64 long long
Both produce compiler errors.
Is there a way to replace "long long" with "__int64" in the code without resorting to brute force manual editing?
BTW, I am using Visual C++ 6.0
-
December 5th, 2010, 09:59 AM
#3
Re: long long data type
How about using LARGE_INTEGER or int64?
Victor Nijegorodov
-
December 5th, 2010, 10:01 AM
#4
Re: long long data type
 Originally Posted by Bob H
Is there a way to replace "long long" with "__int64" in the code without resorting to brute force manual editing?
Did you try Menu -> Edit -> Replace...?
Victor Nijegorodov
-
December 6th, 2010, 11:22 AM
#5
Re: long long data type
'long long' is a new style construct that isn't recognised by VC6.
So no this code won't compile in VC6, and there's nothing to do other than actual replacing (either manually or with an automated 'find and replace') or swap to a more modern compiler.
You can't #define this out since defined names can't have spaces.
So... either use a newer compiler that supports the syntax. Or edit (replace) the actual code.
Last edited by OReubens; December 6th, 2010 at 11:25 AM.
-
December 7th, 2010, 09:45 AM
#6
Re: long long data type
Thanks, I did the manual replace. With some other related changes, I got it to compile.
-
December 7th, 2010, 10:42 AM
#7
Re: long long data type
 Originally Posted by Bob H
I tried:
#define long long __int64
and
typedef __int64 long long
Both produce compiler errors.
Is there a way to replace "long long" with "__int64" in the code without resorting to brute force manual editing?
BTW, I am using Visual C++ 6.0
In order to have only one portable source code you might have a global header like
Code:
// portable.h
#ifndef PORTABLE_H
#define PORTABLE_H
// check if MSVC compiler
#ifdef _MSC_VER
#define LongLong __int64
#else
#define LongLong long long
#endif
Then use LongLong everywhere instead of non-portable type.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|