'mrError32' : missing storage-class or type specifiers

Started by
7 comments, last by Plewna Plewa 18 years, 10 months ago
A program copied from DE SOUSAs book has 2 errors: 1.'mrError32' : missing storage-class or type specifiers Error executing cl.exe. 2. Syntax error : missing ';' before identifier 'Create' in: mrError32 Create (HINSTANCE hInstance, LPSTR szTitle, mrInt iWidth = CW_USEDEFAULT, mrInt iHeight = CW_USEDEFAULT, mrUInt32 istyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE); static LRESULT CALLBACK WndProc (HWND hWindow, UINT iMessage, WPARAM wParam, LPARAM lParam); What do you think may be wrong? I installed Direct SDK properly. Thanks for your help in advance!
Advertisement
The problem is that mrError32 is not declared. Most likely, you are missing the #include of the header file that contains mrError32 declaration.
Vovan
I included that file straight to main.cpp and got slightly more erros
(this is from linking):

02 Main.obj : error LNK2001: unresolved external symbol _Direct3DCreate8@4
02 Main.obj : error LNK2001: unresolved external symbol "public: void __thiscall mrWindow::Run(void)" (?Run@mrWindow@@QAEXXZ)
02 Main.obj : error LNK2001: unresolved external symbol "public: enum mrError32 __thiscall mrWindow::Create(struct HINSTANCE__ *,char *,int,int,unsigned long)" (?Create@mrWindow@@QAE?AW4mrError32@@PAUHINSTANCE__@@PADHHK@Z)
02 Main.obj : error LNK2001: unresolved external symbol "public: virtual enum mrBool32 __thiscall mrWindow::MessageHandler(unsigned int,unsigned int,long)" (?MessageHandler@mrWindow@@UAE?AW4mrBool32@@IIJ@Z)
02 Main.obj : error LNK2001: unresolved external symbol "public: __thiscall mrWindow::mrWindow(void)" (??0mrWindow@@QAE@XZ)
02 Main.obj : error LNK2001: unresolved external symbol "public: __thiscall mrWindow::~mrWindow(void)" (??1mrWindow@@QAE@XZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/02 Main.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.

What does it all mean?
Quote:Original post by Plewna Plewa
I included that file straight to main.cpp and got slightly more erros
(this is from linking):

<snip>

What does it all mean?


It means, most likely, that the header file you included also contains the declaration of such things as mrWindow, which is used in your Main.cpp file, but you never copied and compiled the actual implementation code for mrWindow.
Vovan
I thought that when I compile a project which consist of several files, VC++ will care that all of them shall be properly compiled and linked.

Nevertheless I tried what you suggested compiling all files from my project with .cpp extension. Now I got such errors:

Linking...
02 Main.obj : error LNK2001: unresolved external symbol _Direct3DCreate8@4
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/02 Main.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

02 Main.exe - 3 error(s), 0 warning(s)


(I may send you this stuff if u like)
The first thing means that you aren't linking with DirectX libraries.

The second thing means your main function signature is wrong, I think.

The third thing will automagically go away when you fix the first two.
Vovan
I set lib and include paths from DirectX SDK properly. Also I commented all winmain leaving only declaration and return value. Situation the same.

Besides author of this book somehow managed to compile this (i got compiled version from him) :(
To get rid of error LNK2001: unresolved external symbol _Direct3DCreate8@4 you must link with d3d8.lib. You said that you have already set up the paths, so go to project->settings and in the Link tab add d3d8.lib to the end of the Object/modules edit box.

You are getting error LNK2001: unresolved external symbol _main because you've created the wrong type of project. In this case you've created a Win32 Console Application instead of a Win32 Application. While still in the Link tab of the project->settings window, look through the Project Settings edit box until you find /subsystem:console. Change this part to /subsystem:windows.

As vovansim said, once you've fixed those the last error message will go away.
oh men, great! tnx a lot :)

This topic is closed to new replies.

Advertisement