am not able to use gcc to compile c files..what should i do??

Asked by arj on 2008-07-27

i have already installed build essential.
have made a c file called neel.c
am getting the following result
arjun@arjun-laptop:~$ gcc neel.c
neel.c:1:19: error: conio.h: No such file or directory
neel.c: In function ‘main’:
neel.c:6: warning: incompatible implicit declaration of built-in function ‘printf’
neel.c:7: warning: incompatible implicit declaration of built-in function ‘scanf’

what should i do??

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Jensen Somers
Solved:
2008-08-02
Last query:
2008-08-02
Last reply:
2008-08-01
arj (arjpandey) said : #1

gcc not working

Paolo Naldini (hattory) said : #2

The right command should be:

gcc neel.c -o neel

If this will not work, please paste your neel.c file.

Dan Mulvey (danmulvey) said : #3

It looks like you are trying to include "conio.h". This is a Windows-specific header file. You might want to take a look at ncurses.

Jensen Somers (jsomers) said : #4

The command was correct. If -o is not specified the result will be an executable file called 'a.out'.

As stated by Dan Mulvey, you are trying to include a MS Windows specific header file. Since 'conio' does not exist on Linux you need to find another way of achieving the things you want to do which require the 'conio.h' header file.

When in doubt, post the code of your source file here and we might be able to help.

arj (arjpandey) said : #5

thanks a lot guys but how do i view the a.out file

Dan Mulvey (danmulvey) said : #6

If the compilation fails, there will be no a.out file. First fix the problems with your code; in other words, find a way to do this without including conio.h, and then try compiling again. If your code compiles without error, you will have an a.out file.

arj (arjpandey) said : #7

well my code was compiled. i just wanted to know the command for viewing the a.out file

Best Jensen Somers (jsomers) said : #8

You can run it using the command:
$ ./a.out

arj (arjpandey) said : #9

Thanks Jensen Somers, that solved my question.