c under linux
Page 1 of 113 Replies - 1755 Views - Last Post: 13 January 2008 - 10:26 PM
#1
c under linux
Posted 12 January 2008 - 11:17 PM
i am currently using fedora 8.
Replies To: c under linux
#2
Re: c under linux
Posted 12 January 2008 - 11:30 PM
Please read the rules and post in the correct forum.
And welcome to </dic>
#3
Re: c under linux
Posted 13 January 2008 - 03:05 AM
cricketfancy, on 12 Jan, 2008 - 11:17 PM, said:
i am currently using fedora 8.
You could use a text editor to write the code, then save the file as a e.g. nameOfTheFile.c
Then you can use the command line to compile the code, you should be in the folder where the .c file is.
So write:
gcc nameOfTheFile.c
and if there are no errors to run your program do:
a.out
or
./a.out
#4
Re: c under linux
Posted 13 January 2008 - 05:25 AM
PennyBoki, on 13 Jan, 2008 - 03:05 AM, said:
cricketfancy, on 12 Jan, 2008 - 11:17 PM, said:
i am currently using fedora 8.
You could use a text editor to write the code, then save the file as a e.g. nameOfTheFile.c
Then you can use the command line to compile the code, you should be in the folder where the .c file is.
So write:
gcc nameOfTheFile.c
and if there are no errors to run your program do:
a.out
or
./a.out
it is giving an error as follows:
bash: a.out: command not found
also tried ./a.out but:
bash: ./a.out: No such file or directory
also guide whether we can directly include header files like
stdio.h, conio.h, graphics.h............
#5
Re: c under linux
Posted 13 January 2008 - 06:05 AM
Thing
#6
Re: c under linux
Posted 13 January 2008 - 06:52 AM
#7
Re: c under linux
Posted 13 January 2008 - 07:04 AM
revenge2, on 13 Jan, 2008 - 06:05 AM, said:
Thing
For ubuntu try:
$ gcc nameOfTheFile.c
then:
$ ./a.out
Now, I want to show you a trick it's called google
go to www.google.com
just write the question you need and there and there you go.
This post has been edited by PennyBoki: 13 January 2008 - 07:05 AM
#8
Re: c under linux
Posted 13 January 2008 - 07:13 AM
The standard C library is as follows:
http://www.utas.edu..../C/CStdLib.html
#9
Re: c under linux
Posted 13 January 2008 - 09:59 AM
PennyBoki, on 13 Jan, 2008 - 06:52 AM, said:
hi,
thanks for giving responses.............
but the issue still remains
firstly after tryingg to run by ./nameofthefile.c error came as:
bash: ./sample.c: Permission denied
next
compiler gave error messages for clrscr() and getch() functions
sample.c:(.text+0xa): undefined reference to `clrscr'
sample.c:(.text+0x23): undefined reference to `getch'
lastly
does the ./ concept work under fedora...........
under ubuntu it did work..............
but what about fedora?
coz its giving errors all the time!!
#10
Re: c under linux
Posted 13 January 2008 - 10:57 AM
./name_of_executable will run the executable.
If you get errors compiling, the executable will not be made.
Also, you can't execute the source code. That only works with interpreted languages like Perl and Bash.
Can you please post the code you're trying to compile? I don't think clscr is a standard function...
It's also worth noting that there are plenty of C IDE's out there. I don't understand why people think that programming on Linux always means calling GCC from the commmand line...
Try Eclipse CDT, Anjuta, KDevelop.
All of them should be available from your distribution's package manager.
#11
Re: c under linux
Posted 13 January 2008 - 04:48 PM
#12
Re: c under linux
Posted 13 January 2008 - 04:53 PM
revenge2, on 13 Jan, 2008 - 01:05 PM, said:
Thing
I installed Ubuntu a while back, and I noticed that it does not come with all the files which you need in order to compile and run C code.
Have a look at this thread which details how to install the files you need
http://ubuntuforums....ad.php?t=120421
#13
Re: c under linux
Posted 13 January 2008 - 09:37 PM
Tom9729, on 13 Jan, 2008 - 10:57 AM, said:
./name_of_executable will run the executable.
If you get errors compiling, the executable will not be made.
Also, you can't execute the source code. That only works with interpreted languages like Perl and Bash.
Can you please post the code you're trying to compile? I don't think clscr is a standard function...
It's also worth noting that there are plenty of C IDE's out there. I don't understand why people think that programming on Linux always means calling GCC from the commmand line...
Try Eclipse CDT, Anjuta, KDevelop.
All of them should be available from your distribution's package manager.
hi,
it worked out.............
thanks a lot...........
how to use the other compilers which you specified like eclipse , anjuta , kdevelop
also like under turbo c we have a watch option ...........
how to do that under linux.........
means executing step by step and also viewing the changes.............
#14
Re: c under linux
Posted 13 January 2008 - 10:26 PM
cricketfancy, on 13 Jan, 2008 - 10:37 PM, said:
Tom9729, on 13 Jan, 2008 - 10:57 AM, said:
./name_of_executable will run the executable.
If you get errors compiling, the executable will not be made.
Also, you can't execute the source code. That only works with interpreted languages like Perl and Bash.
Can you please post the code you're trying to compile? I don't think clscr is a standard function...
It's also worth noting that there are plenty of C IDE's out there. I don't understand why people think that programming on Linux always means calling GCC from the commmand line...
Try Eclipse CDT, Anjuta, KDevelop.
All of them should be available from your distribution's package manager.
hi,
it worked out.............
thanks a lot...........
how to use the other compilers which you specified like eclipse , anjuta , kdevelop
also like under turbo c we have a watch option ...........
how to do that under linux.........
means executing step by step and also viewing the changes.............
We know what debugging is. It varies on what IDE you're using. Usually, you click in the margin next to the line number to set a breakpoint, then you go to the debug menu and hit "run". Also in the debug menu should be an option to show the watches window. What IDE are you using, and we may be able to provide slightly more detailed directions.
BTW; Eclipse, Anjuta, and KDevelop are IDEs, like Visual Studio or Turbo C. They all use GCC though.
For command line debugging, do man gdb and read it. That will tell you how to use the GNU DeBugger.
|
|

New Topic/Question
Reply




MultiQuote






|