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

Asked by arj

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:
Last query:
Last reply:
Revision history for this message
arj (arjpandey) said :
#1

gcc not working

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
arj (arjpandey) said :
#5

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

Revision history for this message
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.

Revision history for this message
arj (arjpandey) said :
#7

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

Revision history for this message
Best Jensen Somers (jsomers) said :
#8

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

Revision history for this message
arj (arjpandey) said :
#9

Thanks Jensen Somers, that solved my question.