LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-26-2010, 05:29 AM   #1
SHENGTON
Member
 
Registered: Sep 2008
Posts: 93

Rep: Reputation: 15
What is the best alternative for Borland C++ in Ubuntu


Hello, good evening.

I'm a college student. I'm using Borland C++ 5.02 in Windows. I just installed and updated my Ubuntu 10.10 last week.

Now I want to run my ".cpp" file under Ubuntu. What program did you use to run the program?

Thanks!
 
Old 10-26-2010, 05:40 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
Alternative would be g++

To establish that your Linux/Unix system has the correct C++ compiler installed, at the command prompt type this:
Code:
g++ -v
Ceate a program:

vi hello.cpp

Quote:
\* 0001_hello.cpp *\
#include <iostream>
using namespace std;
int main()
{
cout << endl << "Hello, Happy programming";
return 0;
}
Compilation:

Code:
g++ -Wall -g -o hello.out hello.cpp
Running a program:
Code:
 ./hello.out
 
1 members found this post helpful.
Old 10-26-2010, 05:42 AM   #3
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
you want to "run" the .cpp file, or you want to "compile" it?

Assuming the more likely of the two, you want to compile it first. Use g++, which is the C++ compiler part of the GCC compiler collection. On Ubuntu, I have been told that g++ is not included by default, so you need to install it. If so, open a terminal window (called Gnome-Terminal in your menu system) and enter the following command:
Code:
sudo apt-get install build-essential
Now you should have g++ installed**

To read the documentation for g++, type either:
Code:
man g++
or
Code:
man gcc
To compile something (I usually use gcc (as in this example), not g++ but the syntax should be quite similar-- if you're the programmer, you'll figure it out )):
Code:
gcc -o outputname -lSome-lib -lSome-other-lib source1.c source2.c
Now, if you actually have already compiled the code and have a binary, you can execute it from your terminal just by entering the path to it:
Code:
shell$ /path/to/my/binary

# or if it's in your current directory:

shell$ ./mybinary
** The stars above: I don't use Ubuntu, so I'm going from memory when I wrote that apt-get command for you to install g++. If that command doesn't work (because I've remembered it wrong), you can use your Synaptic package manager just as well, and locate g++ in there and install it.

Good luck! If this doesn't answer the question, or there's more to it, feel free to elaborate.
 
1 members found this post helpful.
Old 10-26-2010, 10:15 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
The real question is: do you want to know how to compile, link and debug, or do you want to be a slave of an IDE ?
 
0 members found this post helpful.
Old 10-26-2010, 12:33 PM   #5
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
rsss..if you want to be slave of a "good" master, try Eclipse which is a good IDE for several languages, including C, C++, java....
 
1 members found this post helpful.
Old 10-26-2010, 12:55 PM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Wow:
Quote:
I'm using Borland C++ 5.02 in Windows. I just installed and updated my Ubuntu 10.10 last week.
But believe it or not, I too occasionally use Borland C++ 5.02 ... for DOS. Specifically, it ships as part of the tool kit for an embedded DOS product: Datalight ROM-DOS.

I agree. I prefer command-line tools. Which, in fact, can be MORE productive than GUIs for many projects:
Quote:
Use g++...
Specifically, "gcc" (C compiler), "g++" (C/C++ compiler), "make" (project builder) and "gdb" (debugger).

Quote:
if you want to be slave of a "good" master, try Eclipse which is a good IDE for several languages, including C, C++, java....
I totally agree. There's also "kdevelop". But my vote would definitely go to Eclipse.

Last edited by paulsm4; 10-26-2010 at 12:59 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding an alternative to Ubuntu aeternitas Linux - General 6 04-27-2010 10:42 PM
Active Desktop alternative for Ubuntu? ZeroClass Ubuntu 5 04-27-2010 08:08 PM
[SOLVED] is there a xinetd.conf alternative for ubuntu? replica88 Linux - General 2 02-10-2010 11:57 AM
Alternative to Ubuntu WillingToLikeLinux Linux - Newbie 18 07-06-2009 12:18 AM
alternative to apt-get in ubuntu? delfick Linux - General 6 08-30-2006 08:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration