-
March 23rd, 2010, 12:18 PM
#1
directory references for included header files (gifsicle)
I am trying to include some code from a Debian package in a program that I am writing. The package code compiles fine on its own, but when I try to include it, it is unable to find some of the files that it includes within itself.
The package is gifsicle, and I'm trying to include a header file gif.h in my own program. gif.h has the include line at the top "#include <lcdf/inttypes.h>" which causes an error when included in my file, but results in no error when the gifsicle package is compiled by itself. To some degree, I see the problem: the inttypes.h file is more correctly referenced as "../lcdf/inttypes.h" relative to where gif.h is in the directory structure, and not as "lcdf/inttypes.h". A subtle, but important difference! At the moment, I actually have a hard time understanding why the gifsicle package compiles at all, because of this reference, but it does.
One solution might be to modify the include lines within the Debian package, something that I really don't want to do.
Is there a way to override where it is the compiler looks for this file without modifying the package source code? Or is it possible to precompile the gifsicle code somehow before the functions are referenced by my code so that all I need is a library reference or the like? Is there some detailed reference material that might explain why the Debian package is able to compile without an exact reference to the location of the header file that it includes?
-
March 23rd, 2010, 04:44 PM
#2
Re: directory references for included header files (gifsicle)
Add more include "roots" to your compilation command line like g++ -I path1 -I path2 (or in the makefile). Every "root" you add the compiler will use in order to find the header.
For instance, say that /.../what/ever/lcdf/inttypes.h is the valid path.
Then setting path1 to /.../what/ever/ will work for all the #include "lcdf/inttypes.h" but not for the #include "../lcdf/inttypes.h".
Adding path2 as /.../what/ever/lcdf/ will do the trick since now the header can be found at /.../what/ever/lcdf/../lcdf/inttypes.h
Last edited by S_M_A; March 25th, 2010 at 05:57 PM.
-
March 24th, 2010, 07:10 PM
#3
Re: directory references for included header files (gifsicle)
Many thanks, S_M_A. That solved the problem!
-
March 25th, 2010, 05:57 PM
#4
Re: directory references for included header files (gifsicle)
You're welcome!
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
|