c under linux

Status
Not open for further replies.

Ratnadeep

Broken In
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...
 

::cyborg::

In the zone
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
 
^^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

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

Ratnadeep

Broken In
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.
 
Last edited:

QwertyManiac

Commander in Chief
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

left this forum longback
@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

Console Junkie
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

Resident Fanatic
./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??
 

QwertyManiac

Commander in Chief
./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.
 

Manshahia

Resident Fanatic
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....
 

Faun

Wahahaha~!
Staff member
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
 

FilledVoid

Who stole my Alpaca!
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

Console Junkie
^^ 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

Commander in Chief
Btw,you shouldn't be using gcc for compiling a C++ program. Use g++ for that purpose, else it'll spew out some garbage.
 
Status
Not open for further replies.
Top Bottom