NO

Author Topic: STDIO help  (Read 8143 times)

taytay

  • Guest
STDIO help
« 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?

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: STDIO help
« Reply #1 on: September 25, 2009, 06:27:00 PM »
What project type did you use to initialize this?
---
Stefan

Proud member of the UltraDefrag Development Team

taytay

  • Guest
Re: STDIO help
« Reply #2 on: September 25, 2009, 06:49:04 PM »
.exe

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: STDIO help
« Reply #3 on: September 25, 2009, 06:53:12 PM »
Try to compile this:

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

taytay

  • Guest
Re: STDIO help
« Reply #4 on: September 25, 2009, 09:02:52 PM »
Wow that was easy lol. Thanks for the help.

ElectroDoc

  • Guest
Re: STDIO help
« Reply #5 on: October 13, 2009, 11:13:20 AM »
#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)