0

I am using MinGW and I have set the path for the same in the Environment Variables. I have also set the path for GTK in the Environment Variables.

  • MInGW has been set up successfully since I am able to use the gcc commands to compile regular C programs.
  • Even GTK has been set up successfully (confirmed by entering pkg-config --cflags gtk+-3.0 in cmd which prints out a list of variables and also ran a already compiled GTK application succesfully).

I have also set the path for pkgconfig in the Environment Variables.

  • Variable Name-PKG_CONFIG_PATH and Value-C:\gtk\lib\pkgconfig

Even after the complete set up, there are some errors which occur when I try compiling a GTK program.

Command used:

gcc hello.c -o hello 'pkg-config --cflags --libs gtk+-3.0'

Note: I have used ` in the actual command and not '(used ' here to prevent highlighting).

Errors:

pkg-config no such directory found. gtk+-3.0 no such directory found unrecognized command line option --cflags unrecognized command line option --labs

Tools I tried:

  • Windows cmd
  • MingW Shell
  • MSYS2
  • Cygwin Terminal (I haven't set up Cygwin path in the environment variables to prevent errors between Cygwin and MingW)

Can someone help me in figuring out what's the actual issue even after completing all the set up steps I mentioned above? Please help me!

Forums I already checked out:

Community
  • 1
  • 1
Mathews Mathai
  • 1,707
  • 13
  • 31

1 Answers1

0

So I understand you have been using:

gcc hello.c -o hello `pkg-config --cflags --libs gtk+-3.0`

You appear to be trying to be clever with pkg-config. Have you tried using --libs & --cflags separately?

e.g.:

gcc `pkg-config --cflags gtk+-3.0` -o hello hello.c `pkg-config --libs gtk+-3.0`

For more info see here

Zander Brown
  • 637
  • 8
  • 16
  • Personally, I use the MinGW shell provided by MSYS2. Do you have `base-devel` installed [`pacman -S base-devel`] as well as `pkg-config`? – Zander Brown Aug 25 '16 at 08:13
  • I have a folder named `Pkgconifg` in the Gtk Folder. I have installed the basic `GCC` requirements using Mingw. I am actually using Mingw. Isn't `base-devel` a default packge in Mingw? Can you provide some more info? – Mathews Mathai Aug 25 '16 at 10:20