Results 1 to 5 of 5
hello everyone ive just brought a new computer for uni its a aspire one
im trying to build programs
this is my code
#include <iostream>
using namespace std;
int main ...
- 08-23-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 3
compiling problems
hello everyone ive just brought a new computer for uni its a aspire one
im trying to build programs
this is my code
#include <iostream>
using namespace std;
int main (void)
{
cout <<"hello world";
return 0;
}
this is my error
[user@localhost UNI]$ g++ -I/usr/include/c++ -o world world.c
world.c:1: error: stray \357 in program
world.c:1: error: stray \274 in program
world.c:1: error: stray \203 in program
world.c:1: error: expected constructor, destructor, or type conversion before < token
world.c: In function int main():
world.c:7: error: cout was not declared in this scope
i cant figure out what is wrong
can anyone help please
thanks
- 08-23-2008 #2
your pound symbol #include <iostream>
is not a pound
this is a pound ## notice the difference
so just change #include <iostream> to #include <iostream>
and re-compile
hope this helps
- 08-23-2008 #3Just Joined!
- Join Date
- Aug 2008
- Posts
- 3
i tryed that and i still got the error
world.c:1:20: error: iostream: No such file or directory
any ideas??
- 08-24-2008 #4
I copied your code and compiled it with g++ -o world world.c and had no problems with it, that is after I change your pound sign to #.
why are you compiling with -I/usr/include/c++
g++ -I/usr/include/c++ -o world world.c
- 08-24-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 3
i tryed that and it worked
thank you soo much i can now write programs in uni now :P
thank you


Reply With Quote