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
Want to make Turbo C++ in Linux
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.
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
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.
// 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
-
- Battalion Quarter Master Havaldaar
- Posts: 221
- Joined: Wed Aug 07, 2002 3:02 pm
- Location: Rawalpindi
use ANSI C/C++
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.
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
Re: c++ compiler
"outstream" typed:
> for windows, i find the Turbo C v3.0 , the best
And for OS, linux, init?
> for windows, i find the Turbo C v3.0 , the best
And for OS, linux, init?
Ayaz Ahmed Khan
[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.
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
War of compilers
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
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