Pelles C forum

C language => Beginner questions => Topic started by: benjaminhitchcock on October 11, 2011, 03:56:03 AM

Title: POLINK: error: Unresolved external symbol '_main
Post by: benjaminhitchcock on October 11, 2011, 03:56:03 AM
please help I am using a program out of my text book for Pelles and I get these two errors:


POLINK: error: Unresolved external symbol '_main.
POLINK: fatal error: 1 unresolved external(s).
Title: Re: POLINK: error: Unresolved external symbol '_main
Post by: AlexN on October 11, 2011, 07:23:20 AM
I don't know you example, but usualy this means that you have a C program for the command line without the C default start function main.
Title: Re: POLINK: error: Unresolved external symbol '_main
Post by: benjaminhitchcock on October 11, 2011, 04:00:40 PM
Thanks my Instructor was able to put a second pair of eyes on it it and this is what was was missing : ;D ;D ;D

int
main(void)
Title: Re: POLINK: error: Unresolved external symbol '_main
Post by: CommonTater on October 11, 2011, 04:06:58 PM
Ok... I know this is only text formatting but
Code: [Select]
int
main (void)

is far less easily read than

Code: [Select]
int main(void)

The "trick" of putting the return type above the function name is often used on Unix or Linux systems because it supposedly speeds up text searches in source files.  This is not the case on Windows systems and especially not in a nice ide like POIDE...  Make your code more readable... don't mess with silly unix tricks.

And don't forget that an int return value means your main function ends with return 0; or an errorlevel....

The minimal skeleton is...
Code: [Select]
int main (void)
  {

     // your code here

     return 0;
}