I am trying to compile a simple program on MacOS 10.6, for example:
$ g++ -o hello hello.cpp
following source:
#include <iostream> int main (int argc, char * const argv[]) { std::cout << "Hello, World!\n"; return 0; }
I get an error message:
hello.cpp:1:20: error: iostream: No such file or directory hello.cpp: In function 'int main(int, char* const*)': hello.cpp:4: error: 'cout' is not a member of 'std'
Therefore, obviously, I need to add the include path somewhere. My question is: where can I find include directories and how can I add them globally (I donβt want to specify an include path when I want to compile). p>
I just installed Xcode 3.1.4 and was able to compile it using Xcode, but not through the command line. I found several header files in this directory:
/Xcode3.1.4/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers
and tried to add it to HEADER_SEARCH_PATHS after reading this question, but no luck.
I am working on Linux and everything works fine there, but I want to continue to do this on MacOS. Any help?
source share