How to install turbo c++ in linux(Xanthros) and create a program?
December 28th, 2008 • Related • Filed Under
josephpt58 asked:
I hav heard that it isn’t that simple to write a program in linux using c.
Lots of commands n stuff.Please simplify what actually I’ve got to do to run turbo c++ in my linux laptop as I am a beginner.
Linuxbuzz.net
I hav heard that it isn’t that simple to write a program in linux using c.
Lots of commands n stuff.Please simplify what actually I’ve got to do to run turbo c++ in my linux laptop as I am a beginner.
Linuxbuzz.net


Comment by Mike on 28 December 2008:
I would recommend doing it manually. It’s not that bad. I’ll give you some basic pointers to get you going. There are actually only 3-ish steps, but I’ll explain them in detail so you can learn it and not just copy-paste some gibberish.
First you need to open a terminal. Go to your “working folder” in your terminal. This is the folder where you are, well, working. This folder should have your .c file (programming in c) or .cpp file (programming in c++)
============================
1. NAVIGATING THE TERMINAL
ls: shows you the contents of your folder
cd foldername: moves where you are into another folder
cd ..: goes up a level in the folders
Note that the command “dir” is Window’s version of “ls”.
Also keep in mind that folder names is case-sensitive, so typing “cd Documents” isn’t the same as “cd documents”.
========================
2. COMPILING YOUR PROGRAM
You need to compile your program so you can run it. You can do this from any folder.
—————————————–
2 (part 1) GETTING A COMPILER
type:
sudo apt-get install g++
why?
sudo: tells the computer that you have administrative privileges
apt-get: means get application
install: install
g++: the name of a widely-used, very popular compiler
In the terminal it’ll show you g++ installing. Now you can compile whenever you want in whatever folder. The g++ package works for compiling BOTH C and C++
—————————
2 (part 2) COMPILING
To compile a C++ program, type:
g++ source.cpp -o programName
why?
g++: tells the terminal that you are compiling a program
source.cpp: the source file that you made. The “source” is what you typed to make the program. If you have multiple files that you want to compile, just list them all here.
example:
g++ file1.cpp file2.cpp -o programName
-o: says that we’re going to name your compiled file (naming the result) I think o stands for output.
programName: whatever you want it to be, but name your output and don’t leave this blank.
=====================
3. RUNNING YOUR PROGRAM
type:
./programName
=======================
That’s all there is to it! If you want to compile programs in C instead of C++ I’d recommend replacing g++ with gcc. gcc is a compiler that only takes C source files.
in short,
install the g++ compiler
see what folders we have
move into folders
make the program
run the program
sudo apt-get install g++
cd ls
cd foldername
g++ sourceFileName.cpp -o programName
./programName
Remember that knowing just HOW to make a program doesn’t mean anything if you don’t know WHY it works. Try to understand the steps posted here.
PS: if your program has errors in it, then they will display when you try to compile it. g++ will tell you what lines you messed up on.
Comment by qgqlochekone on 31 December 2008:
how stupid are a windows user, u think that all OS are like windows, open u’r eyes please!
if u are christina and swicht to musulman, u must understang that both religions are totali diferents!!!!!!! same are on the O.S’s
xandros not comes with all preinstaled, in linux not exist turbo “stupid” c++, thers kdevelop, gambas, tkwin, etc.. and ofcourse the powerfully6 gcc, the C compiler on linux..
u must learnd many before devel in real C code, real C programers are in linux, well, where u need start!?
Debian linux has a lot of documentation, but usage its also hard too!? what a dilema right!
its good to registre to forums in foruns linux sites, but real foruns, not stupid foruns…
1) firts, u must search for terminal usage how to, its stupid show u here how to use, u must search by u’r self
2)second, u must use real linux distro for devel issues, debian or slack are the right answers, and the first linux useds for devel in the world, and debian are the mother of distros and live cd’s..
3) u must lear to program and code in real C ansi, if u comes from windows u dont known nothing yet, conio.h and others libs are non-exist on the 34 diferent O.S. on the world of computing issues…
all of this documentation are on network, but u must take care of orign docs, if the site are sun, or ywing, or any linux devel user or comunity, sure are a good documentation!
see this site for packages of debian for devel on microchips (PIC’s and z80 procesors)
Comment by mckay_gerhard on 2 January 2009:
xandros (no xanthros) its a debian good linux, u must type this command in a konsole:
apt-get install gcc g++ gcc-3.4 g++3.4
and then gcc the C compiler of linux will install, and for a program u have a big problem, u comes from windows, so u dont known how to code C ansii, many libs not are inlinux and others OS, so write a progran and put in any folder, then open a konsole from it folder and just type and execute this command line:
gcc source.c -o execute
the “source.c” are the text plain with C code, and a file “execute” without extension are created in same place, for test program create from code type:
sh ./execute
and thats all …
get more info here:
ja ja ja, if u plain use linux u must comes firts on tree things:
1)read before any thing that u want to do!
2)analize, not asume anything!
3)thinks, thinks, not just click the buttons!