views:

305

answers:

2

I have converted one of my Visual studio 2003 projects into VS2008 and when trying to build the project in VS2008 I get the below mentioned error.

In oledb.h, I have

typedef LONG DBROWCOUNT;

and in sybdb.h, I have

#define DBROWCOUNT      16

When I compile, I get the following errors:

c:\program files\microsoft sdks\windows\v6.0a\include\oledb.h(633) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft sdks\windows\v6.0a\include\oledb.h(633) : error C2059: syntax error : 'constant'
c:\program files\microsoft sdks\windows\v6.0a\include\oledb.h(3005) : error C2059: syntax error : 'constant'

If I comment the //#define DBROWCOUNT 16, then these errors are solved,but I am not supposed to make changes in code, so please help me to come over this error,thanks in advance.

A: 

The problem seems to be that DBROWCOUNT is defined as 16 so it is replaced by preprocessor which results in the line

typedef LONG DBROWCOUNT;

being converted to

typedef LONG 16;

after preprocessing, which is clearly an error. But without looking at the code I can't say why this wasn't happening in vs2003.

Raminder
that i also know and even thats wat my concern that why was it working without any error in VS 2003
I have tried so many methods but i couldnt find any solution, plz anybody...help me........wen i click on error it goes to oledb.h-> typedef Long DBROWCOUNT
somebody advised me to check at which place DBROWCOUNT is being used as 16 and where it is being used as LONG datatype, and i am not supposed to make chnges in oledb.h as it is VS 2008 file, I need to make some changes in compiler settings,even i did it, I made all the settings of VS 2008 as VS 2003 but this error dint go...........
Aditya you can try creating a new project in vs2008 and adding the source code files to this new project.
Raminder
A: 

While I can't speak to how this was not a problem with VC 2003, the main issues here is that you've defined DBROWCOUNT as both a type and a macro constant (which isn't allowed, as you know.) You're going to have to make a change somewhere, or else you won't be able to fix the compiler error. If oledb.h is a system header, then the change will have to be to your constant:

#define DBROWCOUNT 16

Can you change that define macro to read something like:

#define dbRowCount_k 16

And then replace DBROWCOUNT with dbRowCount_k in the places in your code where you are using that value as an integer (as opposed to a type)?

fbrereto
actually i thought that way but i think it need to be like this only.....bcz the saame name is used in a big project and since it was working in VS 2003 so we have to make it work without changing the code, we can make some changes in project settings, so if u have any help with respect to settings we need to make in VS 2008 so that VS 2003 code works without any error....plz help...its urgent.