Want to make Turbo C++ in Linux

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Post Reply
mwalam
Naik
Posts: 61
Joined: Tue May 06, 2003 5:46 pm
Location: UK (Lahore, Pakistan)
Contact:

Want to make Turbo C++ in Linux

Post by mwalam »

Aoa
I am learning C++ from the college. I write the C++ code on Turbo C++ which is run on windows.
I want to make C++ programs in Linux. Can you tell me the C++ complier which is similar to the Borland Turbo C++ or MS-Visual C++ 6.0
Waqas
jargon
Lieutenant Colonel
Posts: 691
Joined: Mon Oct 13, 2003 9:40 am

Post by jargon »

Well you probably already have it installed if you have linux.
the default set of compilers on linux come from the the gnu project.

There would be gcc on your system, a compiler for c code, and if you have .cpp files to compile you use the 'g++' command which invokes gnu's c++ compiler under linux. do a 'man g++' for more info. But a usual 'g++ sample.cpp" will compile the c++ code and create a 'a.out' binary of the code.

if the code you wrote in turbo c++ is ansi/iso standard and generic code, in other words nothing windows specific, it should compile without any problems.
jargon
mwalam
Naik
Posts: 61
Joined: Tue May 06, 2003 5:46 pm
Location: UK (Lahore, Pakistan)
Contact:

Post by mwalam »

i am not sure but my C++ program is like this.


// The_Pier - another simple c++ program

#include <iostream.h>
// Header file for cout and <<.
#include <conio.h>
// Header file for clrscr(), getoxy() and getch()
#include <process.h>

class The_Pier
{
public:
void Splash()
{
system("cls");
cout << "\n\n\n\t\t Be careful not to fall off the";
cout << "\n\t\t end of";
cout << "\n\t\t the pier!";
cout << "\n\t\t SPLASH\n\n\n\t\t\t";
// `\n` is an escape sequence for `new line`
// `\t` is an escape sequence for `tab`
// each inserts the appropirate `character` into the output stream.
}

};

void main()
{
The_Pier Cromer;
// Cromer is an object of class The_Pier
Cromer.Splash();
// The Splash() function is called by the Cromer object
}
these are not compiled in Linux.
Waqas
gh4z4nf4r
Naik
Posts: 65
Joined: Mon Oct 14, 2002 3:51 pm
Location: Wah Cantt
Contact:

Post by gh4z4nf4r »

aoa,
As far as i know conio.h is not ANSI it only for windows/dos so u cant use it. One thing more ur not using any function from conio.h and process.h so u can delete those include lines and i think ur program will compile.

allah hafiz
s7r1k3r
Battalion Quarter Master Havaldaar
Posts: 221
Joined: Wed Aug 07, 2002 3:02 pm
Location: Rawalpindi

use ANSI C/C++

Post by s7r1k3r »

Assalam-O-Alaekum!

Your code shows that you are still using the old style of including header files of the standard libraries. Please note that with ANSI 99 (ANSI C/C++ standard) now to use the standard libraries such as iostream you don't have to put .h after it. In other words:

#include <iostream

using namespace std;

int main(){
cout<<"\\nHello World!\n";
return(0);
}

gcc abides by the standards so this will compile more easily. I really recommend reading "Deitel & Deitel's C++ How to program, Third Edition". All the code in it will easily compile on both linux and windows alike (using a newer compiler on windows, Turbo C is quite old. You can use Visual C). If you really want to learn the language accurately, I recommend reading the above mentioned book.
a10n3 s7r1k3r
outstream
Naib Subedar
Posts: 322
Joined: Wed Sep 24, 2003 10:04 pm
Location: islamabad

Post by outstream »

AoA

for windows, i find the Turbo C v3.0 , the best
Testing?What's that? If it compiles, its good, if it boots up it is perfect.
----------------------------------------------------
Imran
Registered Linux User # 334322
ayaz-khan
Cadet
Posts: 9
Joined: Sat Jan 31, 2004 2:24 pm
Location: Karachi, Pakistan
Contact:

Re: c++ compiler

Post by ayaz-khan »

"outstream" typed:

> for windows, i find the Turbo C v3.0 , the best

And for OS, linux, init?
Ayaz Ahmed Khan
hb
Lance Naik
Posts: 36
Joined: Sun Jul 13, 2003 12:45 pm
Location: internet

Post by hb »

[Salaam]
your code shud work.

if not u wull c gcc g++ errors.
if you are little keen, you can fix urself alone.

go on start doing ur code. you will go on happily. [not endup :)]


-starter-

abc.cpp

$g++ abc.cp
$./a.out

--

tc all
AH.
Never be afraid to try something new. Remember, amateurs built the ark; professionals built the Titanic. -- Anonymous
LinuxBug
Cadet
Posts: 13
Joined: Sat Jan 31, 2004 4:18 pm
Location: Quetta.
Contact:

Post by LinuxBug »

Salam to all..
i think question was .. which complier will work for c++ like turboo C++
i have used EMAX .. a complier and debugger.. in which u can compile and debug c,c++,java and more codes...
Bugz the World
jinix
Lance Naik
Posts: 35
Joined: Tue Jan 06, 2004 7:54 pm
Location: Karachi
Contact:

War of compilers

Post by jinix »

AOA,

Well friends Turbo C++ v3.0 is quite old now. It also doesn't have those ANSI 99 features in it so i think we ppl should avoid using it coz programming is becoming advanced day by day so we should make ourselves comfortable with new ones.

Few days ago we have VC 6.0 (a pappu compiler), g++ n one more Borland C++ 5.02. Now after VS.NET we have VC.NET which is more advance n has more features. I think we should start using it n doesn't stick ourselves to that old Turbo C++ 3.0 coz "In IT old is bold" ;)

Salam,
jinix
Post Reply