Simon,
I've been working on a project for a while. In it are several libs. Each lib defines a default "opts.h" type header that has lots of compiler set-up of the type:-
#ifndef XX
#define XX
#endif
By trial and error I found that defining a "opts.h" file along side main.cpp (at that level) that the compiler would find the .h first and include it. If the file wasn't found it would find the "opts.h" within the library and include that.
All has been fine for months while I worked on this. Now, however, I'm working with Daniel. So as a start off wanted to share my work to date with him last night. So, to do this I wanted to publish the test harness program that also contains all the libs.
To do this I first had to publish each lib first. Once all the libs were published I could then publish the entire program and pass to Daniel the URL for that for him to import.
Had a message from him this morning that the program failed to compile. He found and fixed and let me know what was what.
So I went back to mine and tried to compile it. Sure enough, same error. The error is that the opts.h files with the libs are now being included and not the one defined along side main.cpp
The odd thing is that if I select "edit" and actually open the lib for editing the problem goes away. The search path criteria the compiler uses seems to use different rules depending upon a library "just being used" (ie not opened for editing) or not.
Can you provide us library writers some guide as to how the compiler decides the .h search path criteria so that we can set-up the basic defaults that can then be altered by an end user with an externally defined .h file
Simon,
I've been working on a project for a while. In it are several libs. Each lib defines a default "opts.h" type header that has lots of compiler set-up of the type:-
By trial and error I found that defining a "opts.h" file along side main.cpp (at that level) that the compiler would find the .h first and include it. If the file wasn't found it would find the "opts.h" within the library and include that.
All has been fine for months while I worked on this. Now, however, I'm working with Daniel. So as a start off wanted to share my work to date with him last night. So, to do this I wanted to publish the test harness program that also contains all the libs.
To do this I first had to publish each lib first. Once all the libs were published I could then publish the entire program and pass to Daniel the URL for that for him to import.
Had a message from him this morning that the program failed to compile. He found and fixed and let me know what was what.
So I went back to mine and tried to compile it. Sure enough, same error. The error is that the opts.h files with the libs are now being included and not the one defined along side main.cpp
The odd thing is that if I select "edit" and actually open the lib for editing the problem goes away. The search path criteria the compiler uses seems to use different rules depending upon a library "just being used" (ie not opened for editing) or not.
Can you provide us library writers some guide as to how the compiler decides the .h search path criteria so that we can set-up the basic defaults that can then be altered by an end user with an externally defined .h file