Thread: [Dev-C++] include files those with a .h?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: jag <won...@th...> - 2000-12-29 01:21:07
|
ok i've got my dev cpp ver 4.0 ready to boogy with! cos i'm a novice at the moment bear with me..simple questions first. all the include files for a program end with .h correct? so when you compile a program and it has errors saying it can not find the .h files you have them stored on the hard drive in the wrong place! So saying that do all the include files have to be in the dev cpp include directory? or is there a simpler easier way to go about it? |
|
From: Chris B. <ch...@cb...> - 2000-12-29 21:14:50
|
Hi Jag,
There two ways to include header (*.h) files, and it sounds like you are
using the wrong one!
1. #include <filename>
2. #include "filename"
The first version tells the compiler to look in a predetermined list of
directories for the file. This is usually used to include the standard
include files like iostream.h etc, as they are not stored in the same
directory as your source.
The second version tells the compiler to look for the file in the directory
you specify between the quotes. If you just type in the file name it will
look in the current working directory.
So, if you write your own header file, #include it with the quotes ("")
version. If it is not in the same directory as the working directory, make
sure to qualify it with the full path name.
Remember, you dont have to use the 2nd version for standard include files,
use the first #include <> version.
I hope this helps!
Chris.
----- Original Message -----
From: "jag" <won...@th...>
To: "devc++ mail-list" <dev...@li...>
Sent: 29 December 2000 01:29
Subject: [Dev-C++] include files those with a .h?
> ok i've got my dev cpp ver 4.0 ready to boogy with!
>
> cos i'm a novice at the moment bear with me..simple questions first.
>
> all the include files for a program end with .h correct?
>
> so when you compile a program and it has errors saying it can not find the
> .h files you have them stored on the hard drive in the wrong place!
>
> So saying that do all the include files have to be in the dev cpp include
> directory? or is there a simpler easier way to go about it?
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users
>
|
|
From: Elias P. <Eli...@ao...> - 2000-12-29 22:36:57
|
> ok i've got my dev cpp ver 4.0 ready to boogy with! > > cos i'm a novice at the moment bear with me..simple questions first. > > all the include files for a program end with .h correct? yes, although in C++ they can also end in .hpp > so when you compile a program and it has errors saying it can not find the > .h files you have them stored on the hard drive in the wrong place! > > So saying that do all the include files have to be in the dev cpp include > directory? or is there a simpler easier way to go about it? You can add additional pathes for include files in Dev-C++ for a project when you type them in the "extra include directories" box. Or you can add them to Options/Compiler Options/Directories. And of course, your own include files can always be in the same directory as the source code files. But you have to use #include "..." instead of <...> then. |
|
From: Fabien V. <fv...@fr...> - 2000-12-29 22:37:03
|
Hi. You can include whatever file you want. The files don't have to end with the .h extension. However, the file you include must contain datas that are understandable by the Compiler. The .h extension is here just to say that it is a HEADER file. To include files you 2 ways: #include <stdio.h> Using < > you tell the compiler that the file is stored in the include folder of Dev C++. If your files is somewhere else you use: #include "C:/SOMEWHERE/myfile.txt" Between the " " you put the complete path where your file is. That's all. VIVES Fabien. fv...@fr... http://fvives.free.fr ( Ti92 Fargo programming...). > ok i've got my dev cpp ver 4.0 ready to boogy with! > > cos i'm a novice at the moment bear with me..simple questions first. > > all the include files for a program end with .h correct? > > so when you compile a program and it has errors saying it can not find the > .h files you have them stored on the hard drive in the wrong place! > > So saying that do all the include files have to be in the dev cpp include > directory? or is there a simpler easier way to go about it? > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users > |
|
From: Ioannis V. <no...@ya...> - 2000-12-29 22:38:02
|
#include <merlin.h> makes compiler to look at the default places for the header file (e.g. in Dev-C++ the include directory). #include "merlin.h" makes compiler to look at the same directory with your source code file to find merlin.h. #include "\temp\merlin.h" looks for merlin.h in directory \temp. (I think Dev-C++ uses the UNIX notation for directories /, so in this case it is #include "/temp/merlin.h"). Ioannis > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...]On Behalf Of jag > Sent: Friday, December 29, 2000 3:29 AM > To: devc++ mail-list > Subject: [Dev-C++] include files those with a .h? > > > ok i've got my dev cpp ver 4.0 ready to boogy with! > > cos i'm a novice at the moment bear with me..simple questions first. > > all the include files for a program end with .h correct? > > so when you compile a program and it has errors saying it can not find the > .h files you have them stored on the hard drive in the wrong place! > > So saying that do all the include files have to be in the dev cpp include > directory? or is there a simpler easier way to go about it? > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users > __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com |
|
From: Ramana K. <ra...@my...> - 2000-12-30 08:44:02
|
Hi, Firstly, I suggest you get version 4.01 (the latest) unless that is what you meant :). Yes, all the include files end in a .h (or sometimes a .hpp - but rarely) and they should all be found (under default installation) in C:\Dev-C++\Include\. If you have another .h file you want to use, either copy to this folder or, go to Options->Compiler Options and there, in the Include file path thing, put the path of your other file as well (separate the two by ';'s I think) Ramana -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of jag Sent: Friday, December 29, 2000 12:29 PM To: devc++ mail-list Subject: [Dev-C++] include files those with a .h? ok i've got my dev cpp ver 4.0 ready to boogy with! cos i'm a novice at the moment bear with me..simple questions first. all the include files for a program end with .h correct? so when you compile a program and it has errors saying it can not find the .h files you have them stored on the hard drive in the wrong place! So saying that do all the include files have to be in the dev cpp include directory? or is there a simpler easier way to go about it? _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users |