tiffchuff
asked on
Visual C++ 5 error message....I can't remember what it means!
I've been trying to compile this source code from a Windows program that does absolutely nothing at this point:
#include <windows.h>
LRESULT CALLBACK wndProc(HWND w,UINT msg,WPARAM wp,LPARAM lp)
{
switch(msg) {
case WM_CREATE:
return 0;
case WM_RBUTTONDOWN:
case WM_CLOSE:
PostQuitMessage(0);
DestroyWindow(w);
return 0;
}
return DefWindowProc(w,msg,wp,lp) ;
}
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
WNDCLASS cls;
HWND w;
MSG msg;
memset(&cls,0,sizeof(cls)) ;
cls.lpfnWndProc=wndProc;
cls.hInstance=GetModuleHan dle(0);
cls.lpszClassName="class";
cls.hbrBackground=(HBRUSH) (COLOR_WIN DOW+1);
RegisterClass(&cls);
w=CreateWindowEx(0,"class" ,"test",
WS_POPUP|WS_VISIBLE|WS_SYS MENU|WS_CA PTION,
5,5,200,200,0,0,cls.hInsta nce,0);
while(GetMessage(&msg,0,0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
The problem is, when I try to build this in Visual C++ 5 I get these two error messages:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Proj.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
What's wrong? What I am doing wrong? Thanks for any help! :D
#include <windows.h>
LRESULT CALLBACK wndProc(HWND w,UINT msg,WPARAM wp,LPARAM lp)
{
switch(msg) {
case WM_CREATE:
return 0;
case WM_RBUTTONDOWN:
case WM_CLOSE:
PostQuitMessage(0);
DestroyWindow(w);
return 0;
}
return DefWindowProc(w,msg,wp,lp)
}
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
WNDCLASS cls;
HWND w;
MSG msg;
memset(&cls,0,sizeof(cls))
cls.lpfnWndProc=wndProc;
cls.hInstance=GetModuleHan
cls.lpszClassName="class";
cls.hbrBackground=(HBRUSH)
RegisterClass(&cls);
w=CreateWindowEx(0,"class"
WS_POPUP|WS_VISIBLE|WS_SYS
5,5,200,200,0,0,cls.hInsta
while(GetMessage(&msg,0,0,
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
The problem is, when I try to build this in Visual C++ 5 I get these two error messages:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Proj.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
What's wrong? What I am doing wrong? Thanks for any help! :D
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For your convenience, just create a new empty win32 gui project and add your .cpp file into it and compile!
tiffchuff, are you still with us?
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity, I will suggest to accept "jkr" comment(s) as an answer.
If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Per recommendation comment force/accepted by
Netminder
Community Support Moderator
Experts Exchange
Netminder
Community Support Moderator
Experts Exchange