Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 2nd, 2005, 10:59 PM   #1
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
c++ in linux

Could someone please give me a link to a good totorial on c++ under linux, and maybe on how to use the gcc? i'm using gcc 3.2.3.
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Mar 2nd, 2005, 11:30 PM   #2
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
C++ in linux is the same as in Windows
g++ filename.cpp
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old Mar 3rd, 2005, 12:19 AM   #3
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
In c++ i only worked in Borlanc c++ 3.1 ... and it might be simple but right now I can't get the hello world program going.

And yes, g++ filename.cpp ... had crossed my mind.

So, ... any links would be helpfull 10x
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Mar 3rd, 2005, 2:18 AM   #4
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
then it creates a fiole a.out and run
./a.out
Berto is offline   Reply With Quote
Old Mar 3rd, 2005, 7:54 AM   #5
Benoit
Expert Programmer
 
Benoit's Avatar
 
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 556
Rep Power: 5 Benoit is on a distinguished road
Isn't most Linux programming done in C? I have a book at home called 'Linux Programming by Example' and everything is in C
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4
Benoit is offline   Reply With Quote
Old Mar 3rd, 2005, 9:08 AM   #6
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Ok, when i try using "cout" it sais : `cout' undeclared (first use this function)
#include <stdio.h>
using namespace std;
int main(){
	printf("Hello");
	int c=2;
	printf("%d",c+1);
	printf("\n");
	cout<<"World"<<endl;
}

Again ... if u have any links with tutorial for c++
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Mar 3rd, 2005, 1:30 PM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
If you want to use cout, you have to #include <iostream> as well. I don't know why you're using a namespace that doesn't even exist in the header files you've included.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 3rd, 2005, 1:49 PM   #8
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
neither do I! that's y i was insisting on a LINK .... but no matter .. thanks for the help u gave me .. I'll take it from here
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Mar 3rd, 2005, 2:16 PM   #9
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
http://www.google.com/search?hl=en&q...=Google+Search
if you insist.
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old Mar 3rd, 2005, 5:51 PM   #10
pal
Programmer
 
pal's Avatar
 
Join Date: Mar 2005
Location: Washington
Posts: 90
Rep Power: 4 pal is on a distinguished road
Vim is the choice

--------
Please correct me if there is any flaw in the steps.
Forgive me if I did not understand your question correctly and did not answer your question right, I am pretty new to Linux.
------------------------------
I'm assuming you have C++/C compiler and Vim editor already installed on your system.
In my opinion, Vim is one of the best editor for all purposes especially when I'm working with c++/c code.
Basically you can compile and run most of your C++/C programs from the editor.
First, learn how to use vim by typing -> "vimtutor" from your terminal. You might want to read every directions carefully in the vimtutor. After you get down the basics(or during its process), open Vim editor by typing -> "vim (yourfilename).cpp" from your terminal.
[following process takes place in the Vim editor] If you want your C++/C code to be neatly indented, type -> ":set cindent", and then start coding.
To compile the file, type -> ":make (filename)", if there is a bug, fix it. Okay, now you're done with compiling. To execute the program that you have written, type -> ":!~/(filename)". The program will be executed then.

Last edited by pal; Mar 3rd, 2005 at 5:57 PM.
pal is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:24 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC