<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.acrodus.uk/index.php?action=history&amp;feed=atom&amp;title=Using_pkg-config_as_compiler_and_linker_flags</id>
	<title>Using pkg-config as compiler and linker flags - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.acrodus.uk/index.php?action=history&amp;feed=atom&amp;title=Using_pkg-config_as_compiler_and_linker_flags"/>
	<link rel="alternate" type="text/html" href="http://wiki.acrodus.uk/index.php?title=Using_pkg-config_as_compiler_and_linker_flags&amp;action=history"/>
	<updated>2026-04-04T02:32:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>http://wiki.acrodus.uk/index.php?title=Using_pkg-config_as_compiler_and_linker_flags&amp;diff=93&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;Came across pkg-config files for the first time when using gtk4. The below extract is the makefile for that hello world test.  &lt;pre&gt; CFLAGS = -Wall -g `pkg-config --cflags gtk4` LDFLAGS = `pkg-config --libs gtk4`  all: gtk_test.c         gcc -o gtk_test gtk_test.c $(CFLAGS) $(LDFLAGS)  clean:         rm -f *~         rm -f *.o         rm -f gtk_test &lt;/pre&gt;  Main thing here is the addition of the compiler and linker flags at the top. These use the shell environment variab...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.acrodus.uk/index.php?title=Using_pkg-config_as_compiler_and_linker_flags&amp;diff=93&amp;oldid=prev"/>
		<updated>2024-12-03T09:03:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Came across pkg-config files for the first time when using gtk4. The below extract is the makefile for that hello world test.  &amp;lt;pre&amp;gt; CFLAGS = -Wall -g `pkg-config --cflags gtk4` LDFLAGS = `pkg-config --libs gtk4`  all: gtk_test.c         gcc -o gtk_test gtk_test.c $(CFLAGS) $(LDFLAGS)  clean:         rm -f *~         rm -f *.o         rm -f gtk_test &amp;lt;/pre&amp;gt;  Main thing here is the addition of the compiler and linker flags at the top. These use the shell environment variab...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Came across pkg-config files for the first time when using gtk4. The below extract is the makefile for that hello world test.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CFLAGS = -Wall -g `pkg-config --cflags gtk4`&lt;br /&gt;
LDFLAGS = `pkg-config --libs gtk4`&lt;br /&gt;
&lt;br /&gt;
all: gtk_test.c&lt;br /&gt;
        gcc -o gtk_test gtk_test.c $(CFLAGS) $(LDFLAGS)&lt;br /&gt;
&lt;br /&gt;
clean:&lt;br /&gt;
        rm -f *~&lt;br /&gt;
        rm -f *.o&lt;br /&gt;
        rm -f gtk_test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Main thing here is the addition of the compiler and linker flags at the top. These use the shell environment variable PKG_CONFIG_PATH to look for pkg-config files &amp;quot;*.pc&amp;quot; that specify meta data on how to compile and link in the library. I had to find the location of the gtk4.pc file and add it to the PKG_CONFIG_PATH variable with the below commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo find -type f -name &amp;quot;gtk.pc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export PKG_CONFIG_PATH=/usr/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>