DIGIT-ARC read-only archive · snapshot: July 23, 2026

c under linux

23 posts · originally from https://geek.digit.in/community/threads/c-under-linux.81857/

R
Ratnadeep Original post #1
Mar 5, 2008 at 10:01 AM
hi friends,
My hard disk is burnt and i am using my pc on live linux cds with a pen dirve, to watch movies and for other tasks. I want to practice C on pc. Now I am using knoppix 5.1.1 and ubuntu 7.1 live bootable cds. Then how can i practice gcc compiler under this condition. I want details of running c under linux. I am using pen drive as storage device and live bootable linux cds. I am new linux user.
Please help me.
Please................
Thank YOu...
M
Mar 5, 2008 at 10:08 AM
Knoppix doesn't have gcc installed?
Or you might want to try something like sabayon.
::cyborg::
Mar 5, 2008 at 10:16 AM
why dont u buy a new hdd it is cheaper these days

or if u hv usb u can get ur hands on win xp usb edition no need for an hdd
MetalheadGautham
Mar 5, 2008 at 10:20 AM
^^sabayon is too heavy to be run live. I recomend he try installing knoppix on the pendrive.

and I think it already has GCC installed. Why not try typing GCC in the terminal and see if the program responds with the oh so boring <you need to choose the following options> <blah blah blah> message ?
praka123
Mar 5, 2008 at 11:30 AM
@OP:utilize a pendrive for the time being(if u have) few distros can be booted from usb pendrive.
R
Mar 5, 2008 at 5:19 PM
why dont u buy a new hdd it is cheaper these days

or if u hv usb u can get ur hands on win xp usb edition no need for an hdd

i have spend lot more many on these instruments from ram to my mobile. so for at least a month there will not any money for hdd from home

what is win xp usb edition, is it installation of xp on usb, i tried that but it not worked. explain..
thanks for thread

^^
and I think it already has GCC installed. Why not try typing GCC in the terminal and see if the program responds with the oh so boring <you need to choose the following options> <blah blah blah> message ?

i tried gcc typing gcc in terminal but that not worked.
i am using knoppix 5.1.1

@OP:utilize a pendrive for the time being(if u have) few distros can be booted from usb pendrive.

how to do this
i have 2gb 2.0 pendrive
whatever i use it should run on it and should support for the using c in it
please help i am a new guy

hi
in case of hardware, i have it all.
1gb ram
core2duo processor
motherbord intel g965

but hard disk is burnt
have 2 gb pen drive
please friends help me.
QwertyManiac
Mar 5, 2008 at 5:36 PM
On Ubuntu 7.10, launch it live and in case there is no gcc by default in it, issue the command:
Code:
sudo apt-get install build-essential

This should install the packages required for C, C++ and Fortran languages and Make, etc.
praka123
Mar 5, 2008 at 5:42 PM
@ratandeep:
below link may help installing Ubuntu on usb.get build-essential installed later.
*www.debuntu.org/how-to-install-ubuntu-linux-on-usb-bar
aditya.shevade
Mar 5, 2008 at 6:56 PM
Guys, I think he wants to know how to compile C/C++ programs in *nix.

If that is what you need. Then I think knoppix comes with gcc. So, you just write the program in any text editor. Save it wherever you want. Open the terminal. Go to the path where you saved the file. Then type
Code:
gcc <filename.c>
to compile it. Then use
Code:
./a.out
to run it.

Aditya
Manshahia
Manshahia #11
Mar 5, 2008 at 7:50 PM
./a.out

what is "a" here..
or its just a command..?
not having linux installed at this particular time..
so just curious about it..

also one more thing i want to ask is that when we compile a program in windows say in TC, .exe file is created.
what happens in linux??
Pathik
Pathik #12
Mar 5, 2008 at 8:00 PM
a.out is the default (executable) output file name by gcc. and you execute it using ./
QwertyManiac
Mar 5, 2008 at 8:13 PM
./a.out

what is "a" here..
or its just a command..?
not having linux installed at this particular time..
so just curious about it..

also one more thing i want to ask is that when we compile a program in windows say in TC, .exe file is created.
what happens in linux??
Windows has a habit of making all executable files have a compulsory .exe to execute I suppose.

On Linux, any file with a +x permission is enough to be executed. Extension, name or any other property doesn't matter. (+r for readable, +w for writable and +x for executable, its as simple as this)

So a compiled file may be called XY, or XY..XZ or XX.YY.ZZ, it doesnt matter, it should have the +x permission set and it can be executed.
M
mehulved #14
Mar 5, 2008 at 9:38 PM
./a.out

what is "a" here..
or its just a command..?
assembler.output
I believe it's an elf binary though the name suggests otherwise. See *en.wikipedia.org/wiki/A.out_(file_format)
Manshahia
Manshahia #15
Mar 12, 2008 at 7:25 PM
so..
tried to compile my first program in Linux..
i want to knw that format of C/C++ remains same whether it is done in linux or windows..
second thing i made a simple program and when tried to compile using GCC it said cudnt find conio.h, iostream.h, blah blah blah....
aditya.shevade
Mar 12, 2008 at 7:35 PM
The syntax remains the same as long as you use standard C/C++ code and compilers.
Faun
Faun #17
Mar 12, 2008 at 7:40 PM
Turbo C program needs some polishing before trying on ANSI C compliant GCC compiler :D

Read any ANSI C book and u will find urself right at home with GCC
F
FilledVoid #18
Mar 12, 2008 at 7:47 PM
i want to knw that format of C/C++ remains same whether it is done in linux or windows..

The Format / Syntax C/C++ doesn't change based on the Operating System you use but rather the Compiler you use.

second thing i made a simple program and when tried to compile using GCC it said cudnt find conio.h, iostream.h, blah blah blah....

Because conio.h is not part of the C standard. I'm not sure about iostream though.
aditya.shevade
Mar 12, 2008 at 7:47 PM
^^ Isn't TurboC (Borland Compiler) compatible with ANSI C and GCC with ISO C/C++?

As far as I know, people use ISO standard these days....

@Manshahia, iostream.h is no longer iostream.h according to ISO standards (which are used by GCC, MingW32, etc) but it is plain iostream now. remove the .h extension.
QwertyManiac
Mar 13, 2008 at 2:30 AM
Btw,you shouldn't be using gcc for compiling a C++ program. Use g++ for that purpose, else it'll spew out some garbage.
aditya.shevade
Mar 13, 2008 at 7:18 AM
Isn't g++ part of GCC? (I read in the repository that the package name was gcc-g++-x.x.x.x)
M
mehulved #22
Mar 13, 2008 at 9:20 AM
Well, what Harsh meant was gcc=GNU C Compiler
GCC=GNU Compiler Collection
There's a difference between gcc as a program and GCC suite of compilers.

i tried gcc typing gcc in terminal but that not worked.
i am using knoppix 5.1.1
One more "did not work" person. Like we are GOD.
Can you please tell what did not work?
I hope you didn't expect a full blown IDE to pop up when you typed gcc at the command prompt.
R
Ratnadeep #23
Mar 25, 2008 at 12:07 PM
hello friends,

I am really thankful for your advice and i am now capable of compiling all my c programms in knoppix.
From last 4 moths i am using my pc without hard disk and with no problem or limitation in my work.
Thanks Knoppix.
Now, I am fan of KDE and I liked it most.

Again THANKS Friends.