Hey I am new to C and I am using an online tutorial just to play around and see how i do. well i wrote a little program like the tutorial said but it is not doing what it is suppose to. here is the out put:
rican-linux@debian:~/programs$ cat hello.c
#include < stdio.h>
void main()
{
printf("\nHello World\n");
}
rican-linux@debian:~/programs$ gcc hello.c
hello.c:1:20: error: stdio.h: No such file or directory
hello.c: In function ‘main’:
hello.c:5: warning: incompatible implicit declaration of built-in function ‘printf’
hello.c:4: warning: return type of ‘main’ is not ‘int’
any ideas?
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Learngin C
Typos are the enemy
should be
also make sure you have libc6-dev installed - recompile and see what else pops up
Code: Select all
#include < stdio.h>
Code: Select all
#include <stdio.h>
Every cloud has a silver lining, except for the mushroom shaped ones, which have a lining of Strontium 90.
---------------------------------------------
umop apisdn
---------------------------------------------
umop apisdn
-
- Posts: 63
- Joined: 2007-05-02 00:02
-
- Posts: 63
- Joined: 2007-05-02 00:02
here is another issue i am throwing out there! i am using a text to learn C and it gave an example i tried to compile here is the example:
include <stdio.h>
/*
* Tell the compiler that we intend
* to use a function called show_message.
* It has no arguments and returns no value
* This is the "declaration".
*
*/
void show_message(void);
/*
* Another function, but this includes the body of
* the function. This is a "definition".
*/
main(){
int count;
count = 0;
while(count < 10){
show_message();
count = count + 1;
}
exit(0);
}
/*
* The body of the simple function.
* This is now a "definition".
*/
void show_message(void){
printf("hello\n");
}
and here is the output:
rican-linux@debian:~/programs$ gcc -o ex1-1 ex1-1.c
ex1-1.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
ex1-1.c: In function ‘main’:
ex1-1.c:25: warning: incompatible implicit declaration of built-in function ‘exit’
ex1-1.c: At top level:
ex1-1.c:32: warning: conflicting types for ‘show_message’
ex1-1.c:21: warning: previous implicit declaration of ‘show_message’ was here
ex1-1.c: In function ‘show_message’:
ex1-1.c:33: warning: incompatible implicit declaration of built-in function ‘printf’
any thoughts?
include <stdio.h>
/*
* Tell the compiler that we intend
* to use a function called show_message.
* It has no arguments and returns no value
* This is the "declaration".
*
*/
void show_message(void);
/*
* Another function, but this includes the body of
* the function. This is a "definition".
*/
main(){
int count;
count = 0;
while(count < 10){
show_message();
count = count + 1;
}
exit(0);
}
/*
* The body of the simple function.
* This is now a "definition".
*/
void show_message(void){
printf("hello\n");
}
and here is the output:
rican-linux@debian:~/programs$ gcc -o ex1-1 ex1-1.c
ex1-1.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
ex1-1.c: In function ‘main’:
ex1-1.c:25: warning: incompatible implicit declaration of built-in function ‘exit’
ex1-1.c: At top level:
ex1-1.c:32: warning: conflicting types for ‘show_message’
ex1-1.c:21: warning: previous implicit declaration of ‘show_message’ was here
ex1-1.c: In function ‘show_message’:
ex1-1.c:33: warning: incompatible implicit declaration of built-in function ‘printf’
any thoughts?