gcc error - "iostream: No such file or directory"
Trying to compile the following code 'test.c':
Code:
#include <iostream.h> Code:
test.c:1:22: iostream.h: No such file or directory Code:
test.c:1:20: iostream: No such file or directory The only thing I could think of is that this has something to do with the gcc path. On the first server, gcc is located at '/usr/lib/gcc-lib/i386-redhat-linux/3.2.3', and 'locate /iostream.h' found two instances: Code:
/usr/include/c++/3.2.3/backward/iostream.h Code:
/usr/include/c++/3.4.3/backward/iostream.h Code:
/usr/include/stdio.h Are the /backward/iostream.h the files I want to include in the gcc path? And if so, just how do I modify the gcc path? I did not see a configure, .conf etc. file in either gcc's directory. I did see a 'specs' file which seems to be some sort of configuration file, but I couldn't find a 'path' or 'include' value in it. |
I am no coder, but I see some c++-headers, so
'g++ -o object.o hello.cpp' works fine. The object prints: "Hello World !" when executed. |
iostream is a C++ header, so you need to use g++ to compile it. Using <iosteam.h> is depreciated. Use <iostream> instead and
either explicitly precede the commands with the namespace or use the line "using namespace std;". Another option is to not include iostream.h. The stdio.h header includes the printf function. Just an FYI: The standard C functions have there own manpages (may need to install a document package) so you can enter "man 3 printf" or example. The function definition will include which header needs to be included. |
Quote:
|
test
|
All times are GMT -5. The time now is 09:32 AM. |