473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to include header files..

Hi,

Could somebody tell me how to include my classes in a file which does not see them? (Figure below).


[Level 0] .............................................My Project......................................
.................................................. ...............|.................................. .............
......................................--------------------------------------------------.............
......................................|........... .................................................| .............
[Level 1] ................Classes ............................................... Functions...
......................................|........... .................................................| .............
.......................... --------------------------........................................|......... ....
...........................|...................... ........|........................................| .............
[Level 2] ...Class_A.h...............Class_B.h...................myFunction.h




I know 2 typical methods: Relative path and Absolute path.

But "myFuction.h" in “Function” directory does not accept the relative address: ”My project\Classes\Class_A.h”.

On the other hand, I don’t want to use an absolute path for the sake of portability.

Is there any one who knows what the trick is??!!

Thanks all,
Jul 4 '06 #1
3 7917
pencil
2
Hi,

Could somebody tell me how to include my classes in a file which does not see them? (Figure below).


[Level 0] .............................................My Project......................................
.................................................. ...............|.................................. .............
......................................--------------------------------------------------.............
......................................|........... .................................................| .............
[Level 1] ................Classes ............................................... Functions...
......................................|........... .................................................| .............
.......................... --------------------------........................................|......... ....
...........................|...................... ........|........................................| .............
[Level 2] ...Class_A.h...............Class_B.h...................myFunction.h




I know 2 typical methods: Relative path and Absolute path.

But "myFuction.h" in “Function” directory does not accept the relative address: ”My project\Classes\Class_A.h”.

On the other hand, I don’t want to use an absolute path for the sake of portability.

Is there any one who knows what the trick is??!!

Thanks all,
It's strange that nobody replied to such a simple question.
Anyway I think that it is "..\Classes\Class_A.h"

The ..\ access to the parent directory.
For eg. your project folder relative path from "Function" directory would be
"..\" or also "..\..\My Project"

Is it ok?
Jul 6 '06 #2
Thanks pencil, it was easier than I thought.
Jul 6 '06 #3
pencil
2
Yes, it's easy.
Usually you learn it by experience, but if you've never faced something similar it is difficult to figure it out ( there are no tutorials or something.. )

May the Force be with you (and your code). ;)
Jul 7 '06 #4

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

Similar topics

7
by: mescaline | last post by:
Hi, Suppose a_file.cpp contains a function a_function() Now to include it in main_file.cpp I just do #include "a_file.cpp" and I'm all set. i recently came across this seemingly roundabout...
28
by: Ramesh | last post by:
Hi, I am currently maintaining a legacy code with a very very large code base. I am facing problems with C/C++ files having a lot of un-necessary #includes. On an average every C/C++ file has...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
44
by: Neil Cerutti | last post by:
In Rob Pike's style guide he urges the following: Simple rule: include files should never include include files. If instead they state (in comments or implicitly) what files they need...
12
by: Francois Grieu | last post by:
Can #include safely use a preprocessing token, as in #define HEADERFILE "stdio.h" #include HEADERFILE int main(void) {return printf("Hello, world\n")*0;} TIA, François Grieu
14
by: Pedro Graca | last post by:
Imagine I have a structure with a size_t member: /* foo.h */ struct foo { char const *bar; size_t barlen; }; void make_foo(struct foo *p);
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
9
by: chat | last post by:
Hi, every body. I have 3 files like this: -------------------------------------------------------- file name : header.h #ifndef TEST_H #define TEST_H int a=1; double b=0.5;
111
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
8
by: The Cool Giraffe | last post by:
One thing i do know for sure. When one creates a CPP file, one needs to include the H file. Now, having said that, i wonder if there are some general hints, requirements or standard guide lines on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.