LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   I can't compile c++ code with g++ (https://www.linuxquestions.org/questions/programming-9/i-cant-compile-c-code-with-g-346354/)

malb 07-24-2005 06:50 PM

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. :(

reddazz 07-24-2005 07:01 PM

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

Nylex 07-24-2005 11:00 PM

Please don't cross-post, it's against LQ rules.

ta0kira 07-25-2005 12:58 AM

Is there a space between <<?
ta0kira

EDIT As in < (space) <.

lowpro2k3 07-25-2005 01:25 AM

There was just a thread about this...

malb 07-25-2005 06:54 PM

Thank you very much for your time, folks.

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


All times are GMT -5. The time now is 07:35 PM.