- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to add path of header file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 09:55 PM
тАО06-07-2006 09:55 PM
How to add path of header file
i'm doing my first steps in C/C++ programmig.
I'd like to include in my program iostream.h but when i try to compile it cpp get me an error telling it wasn't able to find iostream.
I know the file is in /usr/local/include/c++/3.4.3/backward/iostream.h
How can I tell my compiler to look for iostream in this directory? It seems it look for it only in /usr/include
I tried a thing like:
cc -I/usr/local/include/c++/3.4.3/backward/iostream.h myfile but without success.
Is there any environment variable to set?
Thank You
Mauro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 09:58 PM
тАО06-07-2006 09:58 PM
Re: How to add path of header file
You need to specify iostream.h in your source code like,
# include
....
while compiling your code, you have to specify
# cc -I/usr/local/include/c++/3.4.3/backward
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 10:02 PM
тАО06-07-2006 10:02 PM
Re: How to add path of header file
http://www.cs.cf.ac.uk/Dave/C/node3.html#SECTION00300000000000000000
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 10:12 PM
тАО06-07-2006 10:12 PM
Re: How to add path of header file
I misunderstood error message:
Firs of all with include directive I have to specify header file with .h otherwise cpp give me an error like:
cpp: "prova1.c", line 3: error 4036: Can't open include file 'iostream'
then the error isn't in my .c file but it seems to be in iostream.h file because I get:
# cc prova1.c -I/usr/local/include/c++/3.4.3/backward
cpp: "/usr/local/include/c++/3.4.3/backward/iostream.h", line 32: error 4036: Can't open include file 'iostream'.
Does Iostream include itself?
I've no problem with stdio and other header files in /usr/include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 10:18 PM
тАО06-07-2006 10:18 PM
Re: How to add path of header file
I will check line 32 and see that is in there. cpp: "/usr/local/include/c++/3.4.3/backward/iostream.h", line 32: error 4036: Can't open include file 'iostream'.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 10:25 PM
тАО06-07-2006 10:25 PM
Re: How to add path of header file
# sed -n '32p' /usr/local/include/c++/3.4.3/backward/iostream.h
#include
It includes itself...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 10:34 PM
тАО06-07-2006 10:34 PM
Re: How to add path of header file
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:31 PM
тАО06-07-2006 11:31 PM
Re: How to add path of header file
#include
//#include
int main ()
{
printf("Ciao Bella!\n");
return 0;
}
# cc prova1.c
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (prova1.o) was detected. The linked output may not run on a PA 1.x system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:36 PM
тАО06-07-2006 11:36 PM
Re: How to add path of header file
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:38 PM
тАО06-07-2006 11:38 PM
Re: How to add path of header file
It continues to be strange the iostream problem :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:47 PM
тАО06-07-2006 11:47 PM
Re: How to add path of header file
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
/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::basic_string
collect2: ld returned 1 exit status
- Tags:
- unsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2006 09:48 AM - edited тАО11-12-2011 06:50 PM
тАО06-08-2006 09:48 AM - edited тАО11-12-2011 06:50 PM
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?