Pelles C forum

Pelles C => General discussions => Topic started by: leo on April 13, 2005, 08:14:01 PM

Title: POLINK error
Post by: leo on April 13, 2005, 08:14:01 PM
What causes "POLINK: error: Unresolved external symbol '_WinMain'."?
Title: Re: POLINK error
Post by: Anonymous on April 13, 2005, 09:17:08 PM
Quote from: "leo"What causes "POLINK: error: Unresolved external symbol '_WinMain'."?

A missing #include <windows.h> in your code will cause that.

Another cause would be that your don't have kernel32.lib in your project's link list... check the project/options/linker tab.

The best solution is to add...

#define WIN32_DEFAULT_LIBS
#include <windows.h>
// other windows headers go here

Either at the top of each .c file or in a global header used by all .c files in your project.  The #define was added in ver 3.00 to let the ide automatically create a list of  libraries whenever a windows header is included.  Works pretty good too...  :)
Title: POLINK error
Post by: project_00 on May 05, 2005, 02:57:54 PM
Hi, I'm having this problem too

Here's my project's link list
kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp.lib

And here's the code

#define WIN32_DEFAULT_LIBS
#include <windows.h>
#include <stdio.h>

int main()
{
int i;
for (i=0; i<10; i++)
printf("%d\n", i);
return 0;
}
Title: POLINK error
Post by: Pelle on May 05, 2005, 03:55:01 PM
In this case you should use a Win32 Console program project, not a Win32 program project. The latter is for programs with a graphical user interface, that starts in WinMain() - not main() as you seem to want.

Pelle
Title: POLINK error
Post by: Anonymous on May 05, 2005, 06:08:50 PM
OK thanks  :P