LinuxQuestions.org
Help answer threads with 0 replies.
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 07-24-2005, 06:50 PM   #1
malb
LQ Newbie
 
Registered: Jul 2005
Posts: 10

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


Hi

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
reddazz
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
Code:
#yum install gcc-c++
to compile your code, you would do
Code:
$g++ -o hello hello.cpp
 
Old 07-24-2005, 11:00 PM   #3
Nylex
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
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

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

EDIT As in < (space) <.

Last edited by ta0kira; 07-25-2005 at 01:15 AM.
 
Old 07-25-2005, 01:25 AM   #5
lowpro2k3
Member
 
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
malb
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.
 
  


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
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

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

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