Pelles C forum

C language => Beginner questions => Topic started by: taytay on September 25, 2009, 06:14:31 PM

Title: STDIO help
Post by: taytay on September 25, 2009, 06:14:31 PM
Here is my very basic code:

#include <stdio.h>
int main (void);
{
   printf("Hello world. \n");
   return 0;
}

and here are my error messages:

Building work.obj.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(3): error #2156: Unrecognized declaration.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(4): warning #2099: Missing type specifier; assuming 'int'.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(4): error #2001: Syntax error: expected ')' but found 'string constant'.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(4): error #2120: Redeclaration of 'printf', previously declared at C:\Program Files\PellesC\Include\stdio.h(171); expected 'int __cdecl function(const char *, ...)' but found 'int __cdecl function()'.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(5): error #2156: Unrecognized declaration.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(5): error #2156: Unrecognized declaration.
C:\Users\Taylor\Documents\Pelles C Projects\Assignment one.exe\work.c(6): error #2156: Unrecognized declaration.
*** Error code: 1 ***
Done.

It's almost like stdio.h was wiped clean or something. What can I do?
Title: Re: STDIO help
Post by: Stefan Pendl on September 25, 2009, 06:27:00 PM
What project type did you use to initialize this?
Title: Re: STDIO help
Post by: taytay on September 25, 2009, 06:49:04 PM
.exe
Title: Re: STDIO help
Post by: TimoVJL on September 25, 2009, 06:53:12 PM
Try to compile this:

#include <stdio.h>
int main (void)
{
  printf("Hello world. \n");
  return 0;
}
Title: Re: STDIO help
Post by: taytay on September 25, 2009, 09:02:52 PM
Wow that was easy lol. Thanks for the help.
Title: Re: STDIO help
Post by: ElectroDoc on October 13, 2009, 11:13:20 AM
Quote from: taytay on September 25, 2009, 06:14:31 PM
#include <stdio.h>
int main (void);
{
   printf("Hello world. \n");
   return 0;
}

of course it will not compile correctly..
(see that ";" at the end of the second line? it means that this line is just a function prototype declaration and not a function header)