error C2143: syntax error: missing ';' before '__stdcall'

来源:互联网 发布:下载农村淘宝app乡村版 编辑:程序博客网 时间:2024/05/06 14:34

今天写代码,出现如下错误:

1>d:\code\git_space\ffmpeg sample\testffmpeg\testffmpeg\videofileutil.h(3): error C2143: syntax error: missing ';' before '__stdcall'1>d:\code\git_space\ffmpeg sample\testffmpeg\testffmpeg\videofileutil.h(3): error C2377: 'DWORD': redefinition; typedef cannot be overloaded with any other symbol1>  c:\program files (x86)\windows kits\8.1\include\shared\minwindef.h(156): note: see declaration of 'DWORD'1>d:\code\git_space\ffmpeg sample\testffmpeg\testffmpeg\videofileutil.h(3): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>d:\code\git_space\ffmpeg sample\testffmpeg\testffmpeg\videofile.cpp(132): error C2664: 'HANDLE CreateThread(LPSECURITY_ATTRIBUTES,SIZE_T,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD)': cannot convert argument 3 from 'int (__stdcall *)(LPVOID)' to 'LPTHREAD_START_ROUTINE'1>  d:\code\git_space\ffmpeg sample\testffmpeg\testffmpeg\videofile.cpp(132): note: None of the functions with this name in scope match the target type

真是百思不得其解,我的原代码很简单,而且是从别的地方复制过来的(已验证正确),如下:

#pragma onceDWORD WINAPI ReadFileProc(LPVOID lpParam);

我反复研究这条代码,没毛病啊,和尚莫得我摸不得?!

实在无法看出这条代码有何不妥,换个思路思考一下。

记得之前处理missing';'相关的提示,大都是这条语句之前的语句忘了加‘;’。

可我这里只有一条语句!

转眼一想,只有一条语句,是我从编辑角度分析的。从编译环境角度,所有的原代码都是链接在一起的。那可能是和这个文件一起被调用的其他 文件出了问题。追踪一下,我在某个文件这样调用:

#include "stdafx.h"#include "VideoFile.h"#include "VideoFileUtil.h"
VideoFileUtil.h文件是我上述那线程调用的文件,那么说有可能问题出在VideoFile.h文件,转看这文件的声明,如下:

class CVideoFile{public:CVideoFile();virtual ~CVideoFile();//删除其他语句}
最后一个大括号有错误提示:expected a ';'

法克!果然是这里,class的最末尾漏了一个分号;

加入分号后,编译,全部PASS!


0 0
原创粉丝点击