Reputation: 143
I had installed msys2 and mingw-gcc, gtk3 package.
pacman -S mingw-w64-i686-toolchain
pacman -S mingw-w64-i686-gtk3
Then I tried to build a test code.
// main.c
#include <stdio.h>
#include <gtk\gtk.h>
int main()
{
printf("hello, msys2!");
return 0;
}
but this test code wasn't build with error.
main.c:2:21: fatal error: gtk\gtk.h: No such file or directory
I checked gtk.h's location and fixed and rebuilded.
// #include <gtk\gtk.h> -> #include <gtk-3.0\gtk\gtk.h>
C:/msys32/mingw32/include/gtk-3.0/gtk/gtk.h:30:21: fatal error: gdk/gdk.h: No such file or directory
I guess there is my mistake i dont know.
Upvotes: 2
Views: 4384
Reputation: 11
At the beginning (compiling with MSYS2) I have the same problem and procedure as suggested using the following command (or something like that):
gcc `pkg-config --cflags gtk+-3.0` hello.c -o hello `pkg-config --libs gtk+-3.0`
However the error message remained... So after some internet research I discovery that I have to type (in my case) the following command:
export PKG_CONFIG_PATH=/mingw32/lib/pkgconfig
or
export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig
And them use the compile command previously quoted and then things start to running better and I was able to compile and run my programs.
The sad thing (one of many) is that I have to do this procedure every time I restart the MSYS2. I'm taking suggestions for not have to do it anymore :-)
And the other sad thing is in the fact that after reinstall a new version of MSYS2 (and Codeblocks in my computer) I still able to compile programs, however they are not running due an error with the zlib1.dll.
The message is
"The procedure entry point inflateReset2 could not be located in
the dynamic link library zlib1.dll"
Upvotes: 0
Reputation: 143
and read gcc option.
gcc `pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0`
Upvotes: 5