how to setup my autoconf project to use GTK? There is only one source file (main.c). I already created all necessary files for autoconf, and when I type "make" it can't find the GTK include "gtk/gtk.h".
// make error
make[2]: Entering directory `/home/anon/projects/firstgtkprog/src' gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c main.c:1:21: fatal error: gtk/gtk.h: No such file or directory compilation terminated.
// configure.ac file contents
AC_INIT([firstgtkprog], [1.0], [bug-developer@foda.com])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([ Makefile src/Makefile ])
AC_OUTPUT
GTK+ uses the pkg-config
utility to provide the necessary compiler and library flags to development tools that build programs with the library. For example, pkg-config --cflags gtk+-3.0
prints out the flags to compile with GTK, and pkg-config --libs gtk+-3.0
prints out the libs.
To integrate this with the Autoconf build system, you need to use the PKG_CHECK_MODULES
macro. This tutorial explains it in some details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.