include

B

Bart van Pelt

During compilation of some software I made, I encounterd the following
behaviour.

I downloaded mysql.4.0.2.tar.gz
untarred it,
configured it for use on /usr/local, so I could use it and also continue to
use mysql.3.23 which was installed by redhat on my system
compiled it
installed it

Now I made some software, to read from mysql database.
This software was compiled with
gcc -I/usr/local/mysql/include -I. mysource.c

This compiled ok and ran ok until...
There was a small difference in mysql-3.23.0 en mysql-4.0.2

And the compiler although I specified an extra include path looked in
/usr/include
where a mysql directory was present with mysql.h. I would have liked the
compiler to first evaluate the specified incode paths by me, instead of the
defaults (which in this case were wrong).

Is this the correct behaviour for the precompiler?

Bart van Pelt
Please reply to (e-mail address removed) since I am not a regular visitor of this
newgroup.
 
V

Victor Bazarov

Bart said:
During compilation of some software I made, I encounterd the following
behaviour.

I downloaded mysql.4.0.2.tar.gz
untarred it,
configured it for use on /usr/local, so I could use it and also continue to
use mysql.3.23 which was installed by redhat on my system
compiled it
installed it

Now I made some software, to read from mysql database.
This software was compiled with
gcc -I/usr/local/mysql/include -I. mysource.c

This compiled ok and ran ok until...
There was a small difference in mysql-3.23.0 en mysql-4.0.2

And the compiler although I specified an extra include path looked in
/usr/include
where a mysql directory was present with mysql.h. I would have liked the
compiler to first evaluate the specified incode paths by me, instead of the
defaults (which in this case were wrong).

Is this the correct behaviour for the precompiler?

Actually, it's implementation-defined. You should ask in gnu.g++.help.
The Standard does not specify how the included files are looked up or
where.

V
 
V

Victor Bazarov

Victor said:
Bart van Pelt wrote: [..]
Is this the correct behaviour for the precompiler?


Actually, it's implementation-defined. You should ask in gnu.g++.help.
The Standard does not specify how the included files are looked up or
where.

Let me add something. The behaviour is standard-compliant, mainly
because the standard does not impose any particular requirements as
to where and how the headers are found. Now, as to whether it's
"correct", I don't know.
 
T

Thomas Maier-Komor

Bart said:
configured it for use on /usr/local, so I could use it and also continue to
use mysql.3.23 which was installed by redhat on my system
compiled it
installed it

Now I made some software, to read from mysql database.
This software was compiled with
gcc -I/usr/local/mysql/include -I. mysource.c

if you configured it for /usr/local the include files will go to
/usr/local/include not /usr/local/mysql/include... So I guess
you passed a wrong value for the -I argument of gcc. But actually
this is really off-topic here.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,516
Latest member
ChrisHibbs

Latest Threads

Top