Pelles C forum

C language => Beginner questions => Topic started by: Al on July 26, 2015, 03:20:05 AM

Title: POLINK error
Post by: Al on July 26, 2015, 03:20:05 AM
I'm new to C and just downloaded Pelles C for Windows.  My C Programming book gives the source code for displaying "Hello, World"  on the screen as a first exercise.  Entered source code and compiled OK.  Tried to run the .exe file and got POLINK: error Unresolved external symbol "WinMain".  I'm running an HP Pavillion Laptop with 64-bit Windows 7.  Is this an incompatibility with Windows 7?  How do I fix the error?
Al
Title: Re: POLINK error
Post by: MichaelW on July 26, 2015, 08:30:04 AM
If you try to build a console app, for which the entry-point function is normally named "main", as a windows app, where the subsystem type on the Linker tab in the project options dialog is set to "Windows", and for which the entry-point function is normally named "WinMain", the linker will return an Unresolved external symbol 'WinMain' error.

The fix is to ensure that the subsystem type matches the entry-point function.
Title: Re: POLINK error
Post by: frankie on July 26, 2015, 11:33:16 AM
To change subsystem go to menu: project=>options. Open linker tab and you will see the subsystem section. Under type change it to console.
Title: Re: POLINK error
Post by: Al on July 26, 2015, 05:40:11 PM
My sincere thanks to both MichaelW and frankie for responding with the fix I needed.  I changed the subsystem to console and everything worked perfectly.  It was particuarly helpful that frankie gave step-by-step instructions on how to effect the change.  I would not have known where to go to find all of that without it.
Al