LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 03-14-2007, 10:07 PM   #1
nuwandias
LQ Newbie
 
Registered: Mar 2007
Posts: 1

Rep: Reputation: 0
Compile a c++ program in Ubuntu 5.10


hi,
i have Ubuntu 5.10 installed in VmWare. i tried writing a c++ program using the vi editor. the code is as follows.

#include <iostream>
using namespace std;

int main(){

cout << "Welcome to Ubuntu !!" << endl;

return 0;
}

i need to know how i can get this compiled and run. I tried several options like using the make command and g++ but i couldn't find a solution.

If some is able to help me pls reply soon.

Reards.
 
Old 03-14-2007, 10:29 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
You probably need to install gcc and g++.
 
Old 03-14-2007, 10:54 PM   #3
Redeye2
Member
 
Registered: Feb 2004
Posts: 489

Rep: Reputation: Disabled
Try installing the basic building utilies (gcc, make, ...). To do this, type in a terminal (or look for the package in Synaptic): sudo apt-get install build-essential
 
Old 03-15-2007, 07:32 AM   #4
pgroover
Member
 
Registered: Sep 2005
Location: Colorado
Distribution: Ubuntu
Posts: 56

Rep: Reputation: 16
Standards

You will want to change the signature of main to match the standards as you could get an error.
int main(int argc, char *argv[])
 
Old 03-15-2007, 01:55 PM   #5
Shautieh
Member
 
Registered: Sep 2006
Distribution: Ubuntu
Posts: 64

Rep: Reputation: 15
unless you really love vi, you could use a more advanced IDE like code::blocks, which will compile your code in one click
really handy
 
Old 03-15-2007, 03:05 PM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by pgroover
You will want to change the signature of main to match the standards as you could get an error.
int main(int argc, char *argv[])
int main() is also standard.
 
Old 03-15-2007, 03:06 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Shautieh
unless you really love vi, you could use a more advanced IDE like code::blocks, which will compile your code in one click
really handy
You’d still need the building utilities.
 
Old 03-15-2007, 05:21 PM   #8
julizar
LQ Newbie
 
Registered: Jan 2007
Distribution: Fedora 7, Gentoo
Posts: 3

Rep: Reputation: Disabled
Vim is great, also you have to try gvim and cvim, it`s a perfect combination. Good Luck!
 
Old 03-16-2007, 12:55 PM   #9
Shautieh
Member
 
Registered: Sep 2006
Distribution: Ubuntu
Posts: 64

Rep: Reputation: 15
Quote:
Originally Posted by osor
You’d still need the building utilities.
of course, but it had already been said and so i was only giving an advice for a good IDE
 
  


Reply



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
Why I can't compile my c program? zhuqlfeixia Programming 6 12-12-2005 09:13 PM
Compile program ust Linux - General 5 05-31-2004 04:37 PM
program want compile dlm4444 Programming 10 09-26-2003 08:08 PM
compile C program juno Linux - Software 4 09-27-2002 12:29 PM
compile program Eddie9 Linux - General 1 05-21-2002 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 08:09 PM.

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