|
|
我照书上写了GameEngine_App类 和 GameEngine_Input类 分别编译它们的cpp没有问题 ,但是一编译main时就会出现很多错误 如下:
Compiling...
main.cpp
d:\my vc++\oo\gameengine_app.h(14) : error C2146: syntax error : missing ';' before identifier 'm_hWnd'
d:\my vc++\oo\gameengine_app.h(14) : error C2501: 'HWND' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(14) : error C2501: 'm_hWnd' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(15) : error C2146: syntax error : missing ';' before identifier 'm_WndClassEx'
d:\my vc++\oo\gameengine_app.h(15) : error C2501: 'WNDCLASSEX' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(15) : error C2501: 'm_WndClassEx' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(19) : error C2061: syntax error : identifier 'LPCTSTR'
d:\my vc++\oo\gameengine_app.h(20) : error C2146: syntax error : missing ';' before identifier 'CALLBACK'
d:\my vc++\oo\gameengine_app.h(20) : error C2146: syntax error : missing ';' before identifier 'WndProc'
d:\my vc++\oo\gameengine_app.h(20) : error C2501: 'CALLBACK' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(20) : error C2061: syntax error : identifier 'HWND'
d:\my vc++\oo\gameengine_app.h(21) : error C2146: syntax error : missing ';' before identifier 'GetWndClass'
d:\my vc++\oo\gameengine_app.h(21) : error C2501: 'WNDCLASSEX' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(21) : warning C4183: 'GetWndClass': member function definition looks like a ctor, but name does not match enclosing class
d:\my vc++\oo\gameengine_app.h(22) : error C2146: syntax error : missing ';' before identifier 'GetHWnd'
d:\my vc++\oo\gameengine_app.h(22) : error C2501: 'HWND' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(22) : warning C4183: 'GetHWnd': member function definition looks like a ctor, but name does not match enclosing class
d:\my vc++\oo\gameengine_app.h(24) : error C2146: syntax error : missing ';' before identifier 'RegWndClass'
d:\my vc++\oo\gameengine_app.h(24) : error C2501: 'ATOM' : missing storage-class or type specifiers
d:\my vc++\oo\gameengine_app.h(24) : error C2061: syntax error : identifier 'HINSTANCE'
d:\my vc++\oo\gameengine_input.h(7) : error C2146: syntax error : missing ';' before identifier 'g_pIDirectInput'
d:\my vc++\oo\gameengine_input.h(7) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
main.obj - 20 error(s), 2 warning(s)
我把书上的代码copy到我的电脑里直接编译时vc就没有报错,但是自己写同样名字的类,再把书上的代码原样copy到自己写的类后就会出现上述错误,link也都连接好,dx路径也设置好了!!请高手指点 感激~~~!!
|
|