libgen.h (which is the .LIB that i should link ?)

Started by Rnard, July 06, 2015, 04:51:47 PM

Previous topic - Next topic

Rnard

Hi everyone,
i was just trying a few samples for libgen.h, and i got the standard error message:

Unresolved external symbol '_WinMain@16

I have scrolled down the .Lib files in the Pelles installation folder (and tried to put some in the linker settings) but none of the ones i chose is correct.
Can someone give me a hint ?

Thank you and regards,
Rnard

Bitbeisser

Doesn't seem to be a library issue, rather a mixup in your program code, like not having a main() function in your project or mixing console mode code with a Win GUI project settings...

Ralf

Rnard

Ralf,

there is a main() function, and the project consists in a blank main.c file.
However, i forgot writing an important detail: the error was generated by the POLINK executable (the linker). This is the full error log:

Building testcod.exe.
POLINK: error: Unresolved external symbol '_WinMain@16'.
POLINK: fatal error: 1 unresolved external(s).
*** Error code: 1 ***
Done.

frankie

Rnard,
look in project options, linker tab and you will see that you're trying to compile for windows (GUI) program.
In this case the linker is looking for 'WinMain' as entry point.
If you change it to console it will look for 'main' as entry point.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Bitbeisser

Quote from: Rnard on July 07, 2015, 01:02:40 PM
Ralf,

there is a main() function, and the project consists in a blank main.c file.
However, i forgot writing an important detail: the error was generated by the POLINK executable (the linker).
Sorry, but that part was obvious.
As Frankie also mentioned, you have a mismatch between selecting a Win GUI project but writing a console mode program.

If you select a "Win[32,64] program" from the "Empty projects" options, then the linker is looking for a WinMain() function in main.c, while in a "Win[32,64] Console program", it will look for a main() function.

ZIP the project in question (right click on the .EXE in the right hand project files window) and attach it to a post, then we can show you exactly where you are going wrong...

Ralf