News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

STDIO help

Started by taytay, September 25, 2009, 06:14:31 PM

Previous topic - Next topic

taytay

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?

Stefan Pendl

What project type did you use to initialize this?
---
Stefan

Proud member of the UltraDefrag Development Team

taytay


TimoVJL

Try to compile this:

#include <stdio.h>
int main (void)
{
  printf("Hello world. \n");
  return 0;
}
May the source be with you

taytay

Wow that was easy lol. Thanks for the help.

ElectroDoc

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)