奇怪的编译错误
这是程序出错的地方:
//header file
#include "bmp002.h "
//macro definition
#define WIDTHBYTES(i) ((i+31)/32*4)
//function declaration
int PASCAL WinMain (HANDLE, HANDLE, LPSTR, int);
LRESULT CALLBACK MainWndProc(HWND , UINT,WPARAM, LPARAM);
这是编译器的报错:
\bitmap002.cpp(17) : error C2146: syntax error : missing '; ' before identifier 'WinMain '
\bitmap002.cpp(17) : fatal error C1004: unexpected end of file found
明明宏定义和函数原型的语法都是对的啊!就是通不过。。
急ing...
[解决办法]
你用了 windows 的类型, 所以必须要 windows.h
\bitmap002.cpp(17) : error C2146: syntax error : missing '; ' before identifier 'WinMain '
这个错误, 很明显 是 PASCAL 未定义导致的。
\bitmap002.cpp(17) : fatal error C1004: unexpected end of file found
这个错误, 其实是预编译头错误, 也是 VS2003 特有的问题, 你按我说的,
加上 #include "stdafx.h " 就没问题了,
PS: #include "stdafx.h " 不等于 MFC 工程. 你连试都不试一下就否定.....
[解决办法]
能问出这样的问题才叫奇怪
好好学习吧
不要怀疑你用的编译环境,这个东西是由很多比你水平高的多的人做出来,又经很多过比你水平高的多的人使用和测试出来的。
\bitmap002.cpp(17) : error C2146: syntax error : missing '; ' before identifier 'WinMain '
\bitmap002.cpp(17) : fatal error C1004: unexpected end of file found
第一个错误是WinMain前缺少;
是指PASCAL未定义。
第二个是说你的文件没有结尾。
一般是由于头文件格式错误,或者缺少#include "stdafx.h "。
估计是你建立工程的方法错了。
不然不会有
error C2731: 'WinMain ' : function cannot be overloaded