g++ compiler cannot locate its library in my fedora machine
Hi, all, new to LINUX. cannot successfully compile.
I run fedora 7, gcc version [root@ Basics]# gcc --version gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-27) I can find gcc library under /usr/include/c++/4.1.2/iostream #include <iosteam> int main() { cout << "hello, world" << endl; return 0; } I got this when compuling: [root@ Basics]# g++ hello.cpp hello.cpp: In function ‘int main()’: hello.cpp:5: error: ‘cout’ was not declared in this scope hello.cpp:5: error: ‘endl’ was not declared in this scope a piece of test code: int main() { return 0 } #g++ test.cpp It does not show any error. |
You need to either add a "using namespace std;" line below your include directive, or change "cout" and "endl" to "std::cout" and "std::endl" respectively.
Also, you're not using the root account all the time are you? If so, you really should make a regular user account for everyday use. |
Quote:
|
All times are GMT -5. The time now is 06:47 PM. |