Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-24-2005, 06:50 PM   #1
LQ Newbie
Registered: Jul 2005
Posts: 10

Rep: Reputation: 0
I can't compile c++ code with g++


I couldn't get help on this from "Newbie" forum. So I post this again.-

I recetly installed g++ on Fedora. (I used "yum install gcc-c++"). It seemed to be fine but if I try to compile the following very simple c++ code, it just gives me an error mesage sayng "expected constructor, destructor, or type conversion before < token"...

#include <iostream>
using namespace std;

int main()
cout << "Hello World \n";
return 0;

I urgently need g++ to do my project. Please help me.
Old 07-24-2005, 07:01 PM   #2
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
To install g++, you need to do as root
#yum install gcc-c++
to compile your code, you would do
$g++ -o hello hello.cpp
Old 07-24-2005, 11:00 PM   #3
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Please don't cross-post, it's against LQ rules.
Old 07-25-2005, 12:58 AM   #4
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Is there a space between <<?

EDIT As in < (space) <.

Last edited by ta0kira; 07-25-2005 at 01:15 AM.
Old 07-25-2005, 01:25 AM   #5
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
There was just a thread about this...
Old 07-25-2005, 06:54 PM   #6
LQ Newbie
Registered: Jul 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you very much for your time, folks.

I re-installed gcc and it's fine now.


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
how i compile a source code? nazib Linux - General 5 02-27-2005 09:13 AM
why cant i compile my c++ code in Mdk9.1 m_dma Mandriva 9 01-09-2004 08:36 PM
Compile problem with souce code neilcpp Linux - Software 3 10-18-2003 01:53 PM
c++ code how to compile and iostream.h saavik Programming 5 09-03-2002 08:30 AM
How to compile source code... Grim Reaper Linux - Newbie 3 04-26-2002 11:28 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:03 AM.

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