0

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?

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
Doug
  • 775
  • 2
  • 11
  • 24

2 Answers2

1

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.

David Grayson
  • 84,103
  • 24
  • 152
  • 189
0

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

-I/some/path/to/gtk-3.0
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • true, I could; however, it seems somewhat overdone when the file is, say, c:\msys64\mingw64\include\gtk-3.0\gtk\gtk.h, to have state -Ic:\msys64\mingw64\include\gtk-3.0\ when c:\msys64\mingw64\include\ is already on the path. – Doug Nov 30 '17 at 12:27
  • Well, tough luck. This is how it's done. If you don't like it, you can change the source code to `#include `. Or make your own symlink from `gtk` to `gtk-3.0/gtk`. – John Zwinck Nov 30 '17 at 12:30