vs2010中winnt.h的错误,该怎么样解决?

alisa123456 2013-06-26 08:19:50
我使用opencv2.3.1和vs2010编写的一个工程项目,出现的问题是如下,请各位高手帮忙?
1>c:\program files\microsoft sdks\windows\v7.0a\include\winnt.h(290): error C2146: 语法错误: 缺少“;”(在标识符“PVOID64”的前面)
1>c:\program files\microsoft sdks\windows\v7.0a\include\winnt.h(290): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\microsoft sdks\windows\v7.0a\include\winnt.h(8992): error C2146: 语法错误: 缺少“;”(在标识符“Buffer”的前面)
1>c:\program files\microsoft sdks\windows\v7.0a\include\winnt.h(8992): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\microsoft sdks\windows\v7.0a\include\winnt.h(8992): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
...全文
1153 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lirenyehua 2016-01-01
  • 打赏
  • 举报
回复
http://blog.csdn.net/zdongfuyu/article/details/38437083 查找时候找到了这个。希望有帮助
alisa123456 2013-06-30
  • 打赏
  • 举报
回复
我在网上看的这个http://www.cnblogs.com/cxun/archive/2007/04/28/731486.html希望对遇到同样问题的人有用。
alisa123456 2013-06-30
  • 打赏
  • 举报
回复
我在网上查的很多人都说是包含头文件的顺序引起的,可是包文件的顺序应该是什么样的呢?
赵4老师 2013-06-27
  • 打赏
  • 举报
回复
偶遇到类似问题都是用 “每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。” 的方法解决的。
zhao1zhong6 2013-06-27
  • 打赏
  • 举报
回复
包含库的头文件顺序引起的,有的需要包含在前面,有的需要包含在后面。
logiciel 2013-06-27
  • 打赏
  • 举报
回复
http://stackoverflow.com/questions/9923628/syntax-error-missing-before-identifier-pvoid64-when-compiling-winnt-h: You need to include windows.h rather than winnt.h. When you include windows.h it will, in turn, include winnt.h. You need to do it this way for the necessary macros to be in place that are needed to compile winnt.h. In this case, POINTER_64 is defined in BaseTsd.h like this: #define POINTER_64 __ptr64But if you include winnt.h before including windows.h then POINTER_64 is not defined. 如果像以下简单例子只有2条include不会出现LZ所遇到的编译错误:
#include <iostream>
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;
 
int main(int argc, char* argv[])
{
	const char* imagename = "lena.jpg";
 
	//从文件中读入图像
	Mat img = imread(imagename);
 
	//如果读入图像失败
	if(img.empty())
	{
		fprintf(stderr, "Can not load image %s\n", imagename);
		return -1;
	}
 
	//显示图像
	imshow("image", img);
 
	//此函数等待按键,按键盘任意键就返回
	waitKey();
 
	return 0;
}
lm_whales 2013-06-27
  • 打赏
  • 举报
回复
检查 #include<winnt.h> 或者 #include<windoiws.h> 前面的代码,主要是 #include “*.h” 中的你自己定义的头文件里,有没有漏写分号; 或者有没有其他编译器,认为需要分号;而没写的地方。

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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