VC.NET2003版关于RPC的一个问题

AplusMartin 2004-04-30 01:03:33
我在.net2002版idl产生的.c文件在编译时没有问题,但在2003版编译后产生了以下了代码
#if !(TARGET_IS_NT50_OR_LATER)
#error You need a Windows 2000 or later to run this stub because it uses these features:
#error /robust command line switch.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will die there with the RPC_X_WRONG_STUB_VERSION error.
#endif

我在RPCNDR.H中查到了TARGET_IS_NT50_OR_LATER的定义
#if (0x500 <= _WIN32_WINNT)
#define TARGET_IS_NT50_OR_LATER 1
#else
#define TARGET_IS_NT50_OR_LATER 0
#endif

由于我一般对IDL产生的c文件不使用预编译头,因而我在stdafx.h中定义的
#define _WIN32_WINNT 0x500不能使用
我只有在idl产生的c文件头部加入这个定义,由于IDL更新导到每次都要重新写一句这个,有没有别的方法可以不让他出这一句,或者是能让IDL的C文件使用预编译头(如果使用则会出现,查到非常文件结尾,如果加入stdafx.h,则会有很多错误出现)
...全文
81 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
AplusMartin 2004-05-02
  • 打赏
  • 举报
回复
加了,不起作用
Onega 2004-05-01
  • 打赏
  • 举报
回复
project settings->c/c++->preprocessor

Preprocess Definitions : 加上 _WIN32_WINNT=0x500
AplusMartin 2004-05-01
  • 打赏
  • 举报
回复
不管用,由于idl产生的C文件不使用预编译头,因此这个定义应用不到它上面
Onega 2004-04-30
  • 打赏
  • 举报
回复
你可以在project settings里设置preprocessor: _WIN32_WINNT=0x500

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧