-
Windows.h not recognised
I am going through a tutorial on DirectX and one continual problem is the windows.h file not being picked up so I get 'unresolved externals' etc.. Presumably this header file should be in the C drive not created by the user, so do I just download something? Here is the code
Code:
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
// create a "Hello World" message box using MessageBox()
MessageBox(NULL,
L"Hello World!",
L"Just another Hello World program!",
MB_ICONEXCLAMATION | MB_OK);
// return 0 to Windows
return 0;
}
Should have said I am using VC++ 2008 Express edition.
-
What exactly are your error messages?
-
1 errorLNK2019: unresolved external symbol_main referenced in function__tmainCRTStartup File MSVCRTD.lib
RTD2 fatal error LNK1120: 1 unresolved externals File Test.exe
-
Goto project properties -> Linker -> System. Set "Subsystem" to "Windows."
In the future, select a Win32 project, and not a console project.
Also, I suggest you upgrade to 2010.
I also suggest you use a proper GUI library, such as Qt, instead of a pure Win32 approach.
-
Excellent that worked. I'm not au fait with the difference between win32 and console programs, shows my inexperience in anything beyone plain console programming.
I've heard of Qt as well and am trying to understand that.