chankm
asked on
C++ Language question
I have tried to build the following code (NOT generated by app wizard) under VC++ but I encounter linker error. Would you please help me out?
// Here are all the code -------------------------- ----
#include <afxwin.h>
class box : public CWinApp
{
public:
box(){}
BOOL InitInstance();
};
BOOL box::InitInstance()
{
AfxMessageBox("This is a message box.", MB_YESNO|MB_ICONQUESTION);
return TRUE;
}
box theApp;
//end -------------------------- ---------- ---------
The linker errors are :
Linking...
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libc.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
box.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
box.exe - 4 error(s), 0 warning(s)
Thanks a lot.
ka ming
(END)
// Here are all the code --------------------------
#include <afxwin.h>
class box : public CWinApp
{
public:
box(){}
BOOL InitInstance();
};
BOOL box::InitInstance()
{
AfxMessageBox("This is a message box.", MB_YESNO|MB_ICONQUESTION);
return TRUE;
}
box theApp;
//end --------------------------
The linker errors are :
Linking...
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libc.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
box.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
box.exe - 4 error(s), 0 warning(s)
Thanks a lot.
ka ming
(END)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
By the way, I think yonat's answer is quite good.