Doug
Doug

Reputation: 805

msys2 and headers in the 'wrong' place

Ok, so, I'm trying to build a third party library with msys2 and I've run into a problem with a few headers, such as gtk.h; the library I'm trying to build expects this to be located via #include <gtk/gtk.h>.

Now, experience on Linux tells me that would be correct under a normal linux environment; however, in the case of gtk, it seems it would have to be gtk-3.0/gtk/gtk.h, which seems like an error in msys to me - is there some sort of selection step I've missed in setting up my msys2 environment? Like the 'eselect' system under Gentoo, something like 'pselect gtk-3.0' that would create a linked directory to gtk-3.0/gtk just called gtk?

Upvotes: 0

Views: 1138

Answers (2)

David Grayson
David Grayson

Reputation: 87376

Assuming that you have installed the mingw-w64-i686-gtk3 package with pacman and that you are running in a MinGW 32-bit shell (MSYS2 has three different flavors of shell that use different toolchains), you can run this command to get the required compile flags for GTK3:

pkg-config gtk+-3.0 --cflags

Most build systems have some kind of support for calling pkg-config. It is basically the standard way to get information about your dependencies.

When it's time to link your program, you should replace --cflags in the comand above with --libs.

Upvotes: 1

John Zwinck
John Zwinck

Reputation: 249093

You simply need to tell the compiler where to find the include directory:

-I/some/path/to/gtk-3.0

Upvotes: 0

Related Questions