NO

Author Topic: libgen.h (which is the .LIB that i should link ?)  (Read 4198 times)

Rnard

  • Guest
libgen.h (which is the .LIB that i should link ?)
« on: July 06, 2015, 04:51:47 PM »
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

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: libgen.h (which is the .LIB that i should link ?)
« Reply #1 on: July 06, 2015, 08:24:12 PM »
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

  • Guest
Re: libgen.h (which is the .LIB that i should link ?)
« Reply #2 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). 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.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: libgen.h (which is the .LIB that i should link ?)
« Reply #3 on: July 07, 2015, 06:33:07 PM »
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

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: libgen.h (which is the .LIB that i should link ?)
« Reply #4 on: July 08, 2015, 01:22:11 AM »
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