Compiler Errors related to CLI

I keep getting this error when I try to build for .NET 4 with \clr
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

Does anyone know why this is happening? I just know it has something to do with MSVCRTD.lib.
It means that you've set up your project as a WIN32 windowed application, yet you use int main() as if you had created a console application.

If you have no GUI, then you'll have to modify the project settings so that it is running a console application. If you are running a GUI then use
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
Instead of int main()

This error looks familiar so I am guessing you are using visual studio. If you're wanting to make this a console app, then right click on your project and follow:
Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Proprocessor Definitions

Replace _WINDOWS with _CONSOLE
Last edited on
Thanks, but I already figured it out. I just didn't see a button to delete the topic. :)
Topic archived. No new replies allowed.