|
-
Jan 7th, 2008, 10:38 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Including header files.
Say I have a header file named as "Complex.h"
On .cpp I want to include it. So I test it on following three ways.
- #include "Complex.h"
- #include ".\complex.h"
- #include "complex.h"
In all ways it works fine. So that means there is no any different between above three line?
When I use IDE to add classes to my applications, the header files are included as the second way.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
-
Jan 7th, 2008, 11:00 PM
#2
Thread Starter
PowerPoster
Re: Including header files.
Seems to me header file name is case insensitive, and first of all header file is searching on the current working folder. If not where it search, include directory of compiler?
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
-
Jan 7th, 2008, 11:55 PM
#3
Re: Including header files.
Different compilers work mostly the same way.. the generic way they process what files to include is like this:
1) If the header file has quotes around it.. search in the current directory. So, for example: You have directory called "MyProgram". A subdirectory in that folder, is "include". If your file "main.cpp" in "MyProgram" tries to include the file "headerfile.h" in "MyProgram\include", it won't work. But, if you move main.cpp into \include, then it will work. Or, you could use "#include include\headerfile.h".
2) If it can't find it.. check compiler include directories.
3) Still can't find it.. throw an error.
4) If it has bent brackets around it <>, check compiler include directories only.
5) Can't find it.. throw an error.
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jan 8th, 2008, 12:06 AM
#4
Thread Starter
PowerPoster
Re: Including header files.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|