472,789 Members | 877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

including header files

hello friends,

This is Radha. I have a querry about one of the concepts of c++ like includeing header files in c/c++ program . When i try to inlclude header files for for implementing a program on message queue..

In that when i try to include one of the header files called "SYS\TYPES.H"
it is showing error like "UNABLE TO INCLUDE SYS\TYPES.H" but it is showing that header file in list and even it is present in the directory in the path which i have gave in the directory settings..

please any one help me out to on this as soon as possible please please please.........


Regards,
Radha.
Apr 6 '08 #1
7 3697
Laharl
849 Expert 512MB
You've got the wrong slash. Use / instead of \.
Apr 6 '08 #2
weaknessforcats
9,208 Expert Mod 8TB
Your compiler's preprocessor looks for header files based on pre-defined paths.

When you #include <aheader.h>, the path t this header must be already defined. Your compiler's documentation will tell how to set this path. Typically, you cn have many paths set and each will be searched for the header.

When you #include "aheader.h", the header is presumed to be in the present working directory (PWD) and if not there, the search reverts the #include <aheader.h>.

I would not use relative paths
Apr 6 '08 #3
Laharl
849 Expert 512MB
<sys/types> is a Unix header that contains gcc's POSIX types. While it is a relative filepath, the <> notation under Linux goes to /usr/include (or the equivalent, depending on distro) and this file is /usr/include/sys/types.h, so the relative path is necessary by the default gcc/g++ settings, anyway.
Apr 6 '08 #4
weaknessforcats
9,208 Expert Mod 8TB
I see. Obviously, my Windows are showing again.
Apr 6 '08 #5
Banfa
9,065 Expert Mod 8TB
Actually in general a path like

#include <sys\types.h>

will work by adding the relative path to the each path in the defined set of include paths to search, it is not uncommon on any platform to have a sys include directory from the normal platform include directory that contains platform system headers, while the platform directory contains the C and/or C++ standard library headers (and other junk sometimes (take a look at the Windows include directory)).

e.g.

C:\MyPlatform\include <-- standard library headers here
C:\MyPlatform\include\sys <-- platform system headers here

Even Microsoft follows this a little putting (some of?) the POSIX headers into the sys directory

e.g.

C:\Program Files\Microsoft Visual Studio 8\VC\include\sys\types.h


Normally the sys directory is never explicitly put into the include path and has to be accessed via a relative path.
Apr 7 '08 #6
weaknessforcats
9,208 Expert Mod 8TB
Don't forget that with Windows you have to double the backslashes:
Expand|Select|Wrap|Line Numbers
  1. C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\sys\\types.h
  2.  
Apr 7 '08 #7
Banfa
9,065 Expert Mod 8TB
Don't forget that with Windows you have to double the backslashes:
Expand|Select|Wrap|Line Numbers
  1. C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\sys\\types.h
  2.  
Not in an include statement only in a C type string.
Apr 7 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: cppaddict | last post by:
Say that your CustomClass.h header files requires #include <string> Now say that your CustomClass.cpp file also requires string. Is it good form to repeat the <string> include to make the...
3
by: Miguel | last post by:
I have a header file that I want to share among various files, and I use: #ifndef UTIL_H_ #define UTIL_H_ file contents #endif
1
by: Ben | last post by:
Hi guys, this *should* be a simple problem, but I've never really got my head around it. I'm hoping somebody on this message board could help me out? I don't really have any experience with VS.NET,...
8
by: nrhayyal | last post by:
Hi c++ Gurus, Need your blessing. while testing few aspects with respect to header file inclusions, i observed few things which i would like to share with you. i have a file sqlca.h in which a...
31
by: Joseph Wakeling | last post by:
Hello all, I'm writing some programs that will be using modules from the GNU Scientific Library (GSL). Include commands within the GSL modules have commands such as, #include...
6
by: Al-Burak | last post by:
I have a class which only purpose is to provide services to a variety of classes in other files. The 'manipulator' class is aware of the other classes only because the header files have been...
2
by: shruti | last post by:
hiii all I'm tryin to call a perl script from a C program in following 2 ways- 1.By callin system function. But there's some problem because the system function is not able to executeany...
18
by: sam_cit | last post by:
Hi Everyone, int main() { printf("not included stdio.h"); } Yes, i haven't included stdio.h and my compiler would generate a warning and would assume that it would return a int, my question...
8
by: nguillot | last post by:
Hello. If I have the following classes: class B {}; typedef B tB; if A is: class A
3
by: KIRAN | last post by:
Hello all, My question is about the way of including header files(*.h) in source files (*.c) I have three folders, -build ( for project makefiles) -include ( for *.h files) -src (for *.c...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.