views:

10

answers:

1

If there are two source files a.c and b.c: a.c includes the glib.h of glib-2.6.6 and b.c includes glib.h of glib-2.12

Then I compile them and link them together and generate target program. Assume that a.c is not using any new feature introduced in after v2.6, will including different version of headers cause any problem? If so, when will such problem happen?

A: 

It shouldn't cause a problem. That's because GLib maintains API compatibility for all versions in the 2.x series. Whatever version of the headers you use to compile your program, you can link to any version of the library, as long as you aren't using any features not present in that version of the library.

However, you seem to be making your life needlessly difficult:

I'm using a Makefile that can specify the root directory of GLiB and using #include "glib.h" in the code. I have multiple versions of glib headers installed.

Why on earth would you want to do that??

ptomato