Please help I can't compile c++ file
Hi
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'm a newbie and don't know what to do.. Please help me. :( |
What is the command you're using to compile? The code looks fine to me. Edit: also, this should have been in the Programming forum.
|
Thanks for reply.
I used "g++ HelloWorld.cpp". |
You should be using:
Code:
g++ SOURCE_FILE.CPP -o OUTPUT_FILE Code:
g++ HelloWorld.cpp -o HelloWorld |
Using "g++ HelloWorld.cpp" is fine, just the executable will be called a.out.
|
exactly...
"g++ filename.cpp -o filename" doesn't work either. |
What are the compiler errors?
|
Quote:
|
"expected constructor, destructor, or type conversion before < token" comes from the compiler. I found loads of similar errors when searching Google, but no way to fix them. Maybe his GCC is broken, or something.
|
Thanks heaps.
I just re-installed gcc and it's fine now. |
All times are GMT -5. The time now is 11:55 AM. |