[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Programmin Question
On Mon, Jun 25, 2001 at 10:27:28PM -0700, Travis Davies wrote:
> I am currently writing a program C++ in which I would
> like to #include a file of my own. So at the the
> beginning of my program I wrote #include <myfile.mf>.
>
> But when I compile the compiler gives an error message
> saying that: "myfile.mf: No such file or directory"
>
> so obviously the compiler is looking in a directory
> for myfile.mf. but what directory? Im using RH Linux
> version 7.0.
It's searching your include path.
There's an easy way and a hard way to fix it. The easy way is to change it
to:
#include "myfile.mf"
With quotes, and put it in the current directory OR compile it like:
gcc -I/myfile.mf/path/ -o myprog myprog.c
The hard way to do it is to leave the carots around <myfile.mf> and compile
it like this:
gcc -I- -I/myfile.mf/path/ -o myprog myprog.c
This way is harder because:
A: I've never tried it and am not completly sure if it will work, just going
out of the gcc man page and
B: It will (according to the aforementioned man page) inhibit gcc's automatic
checking of the current directory, which may break other things.
Anyhow, pick the method which suits you best. BTW, I know /usr/include/ is in
the default include path, I'm not sure about anything else, nor do I know how
to get gcc to show the current include path.
--
Jordan Bettis <http://www.hafd.org/~jordanb/>
Pray: To ask that the laws of the universe be annulled in behalf of a single
petitioner, who is confessedly unworthy.
-- Ambrose Bierce
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.