![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Noob question on comparing #'s. | kirkm76 | UNIX for Dummies Questions & Answers | 6 | 05-16-2007 11:03 AM |
| Noob sorting question | Hexabah | UNIX for Dummies Questions & Answers | 1 | 02-11-2007 04:57 AM |
| complete noob | avdrummerboy | UNIX for Dummies Questions & Answers | 3 | 12-04-2006 12:25 PM |
| I am a unix noob | alt+f4 | UNIX for Dummies Questions & Answers | 4 | 04-28-2006 09:01 PM |
| question about JAVA compiling .. | ANAMIKA56 | SUN Solaris | 7 | 08-11-2005 11:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Question about compiling (noob)
I'm just getting started to lean C and I'm using Ubuntu today I found a tutorial at this site: http://einstein.drexel.edu/courses/C..._tutorial.html and I got an error after compiling the fist code:
Code:
#include < stdio.h>
void main()
{
printf("\nHello World\n");
}
Code:
arya@arya-computer:~/Desktop$ cc 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’ |
|
||||
|
Quote:
![]() Now it gives this error Code:
arya@arya-computer:~/Desktop$ cc hello.c hello.c:1:19: 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’ |
|
||||
|
The return type of main should be int, not void. The code below compiled & ran fine on my computer. Does Ubuntu use gcc? ( If so, your version of 'cc' is possibly a link to 'gcc'. ) I'm using gcc and it worked.
Code:
#include <stdio.h>
int main()
{
printf("\nHello World\n");
}
|
|
||||
|
Quote:
Code:
arya@arya-computer:~/Desktop$ gcc hello.c hello.c:1:19: 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’ |
![]() |
| Bookmarks |
| Tags |
| linux, ubuntu |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|