Hi Friends,

I have 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.

Recommended Answers

All 4 Replies

Hi Friends,

I have 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.

Its just as easy as any other version of C...If you mean compiling a program in Linux using GCC then that's simple..From the terminal type

gcc filename.c -o filename

and then to run


I don't think Turbo C++ is ported to Linux so you can't used it in a Linux environment..

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++)


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".


You need to compile your program so you can run it. You can do this from any folder.

sudo apt-get install g++

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

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




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

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.
me (computer science major at UM)

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: http://qgqlochekone.blogspot.com

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!

how to create a calculator using a turbo c???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.