PDA

View Full Version : C++ Programmers



robfinalfantasy
02-18-2007, 02:16 AM
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

MessageBox(NULL, "\tHello World!", "My first windows app", NULL);
return 0;
}

When I compile the code it says there are 0 errors, 0 warnings.
When I execute the code it says there are 2 errors.

--------------------Configuration: main - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

main.exe - 2 error(s), 0 warning(s)

Any guesses on what they could be? I copied the code exactly from this tutorial (http://www.tutorialized.com/tutorial/OpenGL-and-Windows/4274).

My compiler is Microsoft Visual C++ 6.0 and yes I have a main.cpp defined (which only contains the code above). This code uses OpenGL to produce a window of some sort. Could it have something to do with my OpenGL drivers or possible lack of? My video card is an ATI RADEON XPRESS 200M with drivers dated 4/11/2005 version 6.14.10.6539.

Dr Unne
02-18-2007, 03:53 AM
Second result on a google search for "LIBCD.lib fatal error LNK1120: 1 unresolved externals":

Windowed applications on Win32 begin at WinMain() while character mode
applications begin at main(). Apparently you have mistakenly created a
Windowed project with console application code.

There are many other results which I did not read through.

Cruise Control
02-18-2007, 04:15 AM
This thread takes me back.

robfinalfantasy
02-18-2007, 03:30 PM
Second result on a google search for "LIBCD.lib fatal error LNK1120: 1 unresolved externals":

Windowed applications on Win32 begin at WinMain() while character mode
applications begin at main(). Apparently you have mistakenly created a
Windowed project with console application code.

There are many other results which I did not read through.That's exactly what I'm trying to do. I'm sick of character black/white appplications. I found what the problem was though. Apparently Windowed applications have to be part of a project while character mode applications don't. I can't just open the code and run it (which is what I was doing).