从 VS 2003 迁移到 VS 2008 期间出现的问题

发布于 2024-08-02 03:10:06 字数 710 浏览 4 评论 0原文

我已将 Visual Studio 2003 项目之一转换为 VS2008,当尝试在 VS2008 中构建该项目时,出现以下错误。

在 oledb.h 中,我有

typedef LONG DBROWCOUNT;

,在 sybdb.h 中,我有

#define DBROWCOUNT      16

当我编译时,出现以下错误:

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'

如果我注释 //#define DBROWCOUNT 16,那么这些错误就可以解决,但是我不应该更改代码,所以请帮助我解决这个错误,提前致谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

静水深流 2024-08-09 03:10:06

问题似乎是 DBROWCOUNT 被定义为 16,因此它被预处理器替换,导致该行在

typedef LONG DBROWCOUNT; 

预处理后被转换

typedef LONG 16; 

,这显然是一个错误。 但如果不看代码,我无法说出为什么在 vs2003 中没有发生这种情况。

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.

遮云壑 2024-08-09 03:10:06

虽然我不能说这在 VC 2003 中不是问题,但这里的主要问题是您将 DBROWCOUNT 定义为类型和宏常量(如您所知,这是不允许的。)我们必须在某个地方进行更改,否则您将无法修复编译器错误。 如果 oledb.h 是系统标头,则必须对常量进行更改:

#define DBROWCOUNT 16

您能否更改 define 宏以读取类似以下内容:

#define dbRowCount_k 16

然后将 DBROWCOUNT 替换为dbRowCount_k 在代码中将该值用作整数(而不是类型)的位置?

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)?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文