LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 06-20-2005, 03:52 PM   #1
goosie
Member
 
Registered: May 2005
Distribution: Mandrake Linux 10.0 Community
Posts: 44

Rep: Reputation: 15
C++ tutorial (link)


Ok, i just started myself and I started in C++ and found this tutorial:
http://www.cprogramming.com/tutorial.html
its easy to follow, so i figured i'd post it on here (even though its already been posted before...) just to help out anyone else who is interested in starting.
 
Old 06-20-2005, 06:10 PM   #2
mandrakelinux
Member
 
Registered: Apr 2005
Posts: 55

Rep: Reputation: 15
thanks goosie
may i'll follow you to learn c++ but still want to know something
 
Old 06-20-2005, 07:23 PM   #3
goosie
Member
 
Registered: May 2005
Distribution: Mandrake Linux 10.0 Community
Posts: 44

Original Poster
Rep: Reputation: 15
i just started today and after searching for tutorials that seems to be the clearest one... i made a papers scissors rock game just finished it i love my game...
 
Old 03-11-2006, 09:00 PM   #4
graciejj_82
Member
 
Registered: Feb 2006
Distribution: Fedora 2
Posts: 63

Rep: Reputation: 15
I'm trying to learn c++ as well.

I followed your link. It seems to have a TON of information. but when I try to compile to first program, i get a bunch of errors.

The code is:
#include <iostream>

using namespace std;

int main()
{
cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
cin.get();
}


i type in this at the terminal:
gcc f.cpp -o hello

and I get the following errors:
/tmp/ccpI2yKM.o(.text+0x19): In function `main':
: undefined reference to `std::cout'
/tmp/ccpI2yKM.o(.text+0x1e): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccpI2yKM.o(.text+0x29): In function `main':
: undefined reference to `std::cin'
/tmp/ccpI2yKM.o(.text+0x2e): In function `main':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >::get()'
/tmp/ccpI2yKM.o(.text+0x5a): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccpI2yKM.o(.text+0x89): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccpI2yKM.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


I'm using fedora core 2, and I'm almost certain I've used gcc in the past and made it work, maybe I had to much Amaretto that night...?
 
Old 03-11-2006, 09:44 PM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Either compile like this:

gcc -lstdc++ f.cpp -o hello

or like this:

g++ f.cpp -o hello

The linking errors come from the fact that when you use gcc instead of g++ it doesn't automatically link against the standard c++ libraries and thus it can't find the iostream stuff.
 
Old 03-12-2006, 08:37 AM   #6
graciejj_82
Member
 
Registered: Feb 2006
Distribution: Fedora 2
Posts: 63

Rep: Reputation: 15
WONDERFUL!!! g++ f.cpp -o hello worked great! Thanks alot.
 
  


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
sendmail tutorial link shadowsurfer Linux - Newbie 1 04-14-2005 01:57 AM
OpenBSD 3.6 install D-Link 300T / D-Link DFE 528TX lesleyb *BSD 2 04-01-2005 06:29 PM
Wake on Lan - Link on b4 power up, No Link light after shutdown? Mark007 Linux - Networking 0 11-20-2004 08:16 PM
eth1... failed; no link present. Check Link? illegalien Linux - Networking 3 11-03-2002 10:46 PM
How about a weekly tutorial? or just a tutorial Alinuxnoob LQ Suggestions & Feedback 2 04-09-2002 08:30 PM

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

All times are GMT -5. The time now is 05:56 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