6

if i try and compile the tutorial code for GTK3 with the command

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

it gives off the error

gcc: error: pkg-config --libs --cflag gtk+-3.0: No such file or directory

However if i run the command

pkg-config --libs --cflag gtk+-3.0 > makefile

and then edit the makefile such that the output of the above command is after

gcc simple.c -o simple

then it compiles with no problems at all. What gives?

Draymire
  • 61
  • 1
  • 1
  • 2

1 Answers1

5

I got this problem too, but after carefully see the the code, it just a typo. Please see again your command,

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

It should be,

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

Can you see the different? The ' should be `. It works for me!

sugab
  • 4,337
  • 4
  • 30
  • 48
  • 1
    I had the same problem and your solution worked for me. +1 –  Apr 09 '15 at 07:46
  • 1
    It took more than 10 minutes to understood the difference between those two lines ( Just a hint for others , it is the **`** mark before pkg-config and after gtk+-3.0) – Arun Oct 31 '21 at 04:23