[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [G++ n00b] Include and lib files

From: Lionel B
Subject: Re: [G++ n00b] Include and lib files
Date: Mon, 19 Nov 2007 13:16:21 +0000 (UTC)
User-agent: Pan/0.132 (Waxed in Black)

On Mon, 19 Nov 2007 12:45:35 +0100, Stefan Kristensen wrote:

>>>>     #include "mysql/mysql.h"
>> Ah, I think perhaps that should be:
>>     #include <mysql/mysql.h>
> That doesn't work either. Is there a way to check where g++ looks for
> include files when not using the -I option?

It's actually the preprocessor that does include path processing. The -v 
option should tell you the final form of the include path, whether you 
specify -I options or not.

Eg. on my system I get:

$ cpp -I/tmp -v
[other stuff]
#include "..." search starts here:
#include <...> search starts here:
End of search list.

By the way, earlier you said:

>> Most likely /usr/local/include will be on the include path for your g++
>> by default, so:
> It is.

... so how did you know that?

>> You also have to link to the appropriate library(s). Hopefully the docs
>> will tell you how to do that.
> Yup. When using -I, -L and -l, everything works.

Note that -I doesn't specify anything about libraries, just included 
headers. -l tells the linker which libraries to link to, while -L tells 
the linker where to look (besides default locations) for them.

> I'm just a little curious why I have to use the -I option when the
> files are in a standard path?

You shouldn't have to. Perhaps you could post your *exact* compile 
command, without -I options, but with -v, and the *complete* output.


Lionel B

reply via email to

[Prev in Thread] Current Thread [Next in Thread]