Newbie having problems w/ gcc and g++
Hello all -
I'm new to linux, and I just got a nice redhat 9 system set up. Everything is working the way I want it to, and I am very impressed w/ linux and everything else so far. However, I am having a problem with g++. It doesn't seem to be able to find any libraries. For instance, when compiling the simple hello world program that follows: #include <iostream> int main() { cout << "Hello World!\n"; return 0; } I use the command 'g++ hello.cpp -o hello' and get the following set of error messages: hello.cpp: In function `int main()': hello.cpp:5: `cout' undeclared (first use this function) hello.cpp:5: (Each undeclared identifier is reported only once for each function it appears in.) I get the same type of messages if I try to use anything w/ string, even after doing a #include <string>. It's my understanding that g++ looks in /usr/lib and /lib for libraries when it is doing a complile. I looked in both of those dirs, and they do have files (this is where I show my c++ newbie status as well) but neither dir had anything called iostream or any related name that i could find. So I guess the question really is... where are all of the common libraries (like iostream and string) placed on a linux system, what exactly are the files called, and how can I tell g++ to look in those dirs if it isn't allready. I have read the man page for g++ and also tried extensive googling for an answer to this question, but have not been able to find anything =( Any help that you can offer would be greatly appreciated =) |
Use std::cout -- on modern C++ implementations the std namespace is not imported by default.
Oh, and this probably should've been posted in the programming forum. |
*blushes deep crimson* haha - sad thing is i knew that, it just slipped my mind... oopsie. Thanx for the help tho =) Sorry if posted in the wrong catagory, it just sounded like a newbiesh question.
|
All times are GMT -5. The time now is 06:57 AM. |