Operating System - Linux
1753454 Members
6160 Online
108794 Solutions
New Discussion

How to add path of header file

 
Mauro Gatti
Valued Contributor

Re: How to add path of header file

At the end I think there is a problem with iostream.h

I tried to use gcc instead of cc.
Well here there are the results:

# gcc -x c prova1.c -I/usr/local/include/c++/3.4.3/backward
In file included from prova1.cpp:2:
/usr/local/include/c++/3.4.3/backward/iostream.h:32:20: iostream: No such file or directory
In file included from prova1.cpp:2:
/usr/local/include/c++/3.4.3/backward/iostream.h:34: error: parse error before "std"

# gcc -x c++ prova1.cpp -I/usr/local/include/c++/3.4.3/backward
In file included from /usr/local/include/c++/3.4.3/backward/iostream.h:31,
from prova1.cpp:2:
/usr/local/include/c++/3.4.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (/var/tmp//cc1Tfudc.o) was detected. The linked output may not run on a PA 1.x system.
/usr/ccs/bin/ld: Unsatisfied symbols:
std::ios_base::Init::~Init()(code)
std::ios_base::Init::Init()(code)
std::basic_string, std::allocator >::size() const(code)
std::basic_string, std::allocator >::operator[](unsigned long) const(code)
collect2: ld returned 1 exit status
Ubi maior, minor cessat!
Dennis Handly
Acclaimed Contributor

Re: How to add path of C++ header file

>I'd like to include in my program iostream.h but when I try to compile it cpp gives me an error telling it wasn't able to find iostream.

You can't use iostream in C. So switching to g++ or aCC is the correct direction. You may want to use .C as a suffix to indicate the source is C++.

>At the end I think there is a problem with iostream.h

There isn't anything wrong with <iostream.h> except that the standard file name is <iostream>.  g++ is allowing you to use <iostream.h> by having it include the official file <iostream>. It seems your final problem with unsats shows you are missing a g++ library?