[英]How can I connect modules?
So, I am trying to write Makefile.am that will check the source code and the dependencies for the build. 所以,我正在尝试编写Makefile.am,它将检查源代码和构建的依赖项。
configure.in configure.in
AC_PREREQ([2.68])
AC_INIT([hello], [1.0], [basinbug at yahoo.com])
AC_CONFIG_SRCDIR([src/hello.cpp])
AM_INIT_AUTOMAKE
AC_PROG_CXX
PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.10])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
src/Makefile.am SRC / Makefile.am
bin_PROGRAMS = hello
hello_CFLAGS = $(GTK_CFLAGS)
hello_LDFLAGS = $(GTK_LIBS)
hello_SOURCES = hello.cpp
what happens when i run "make" 当我运行“make”时会发生什么
Making all in src
make[1]: Entering directory `/home/maza/123/src'
g++ -DPACKAGE_NAME=\"hello\" -DPACKAGE_TARNAME=\"hello\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"hello\ 1.0\" -DPACKAGE_BUGREPORT=\"basinbug\ at\ yahoo.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"hello\" -DVERSION=\"1.0\" -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.cpp
hello.cpp:2:21: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.
make[1]: *** [hello.o] Error 1
make[1]: Leaving directory `/home/maza/123/src'
make: *** [all-recursive] Error 1
If I'm going as AC_PROG_CC, they are used for compile the string, through AC_PROG_CXX it is not used 如果我要作为AC_PROG_CC,它们用于编译字符串,通过AC_PROG_CXX它不被使用
You are telling the autotools that your project is a C++ project (with AC_PROG_CXX
) but you are then setting a C flag variable ( hello_CFLAGS
). 您告诉autotools您的项目是一个C ++项目(使用AC_PROG_CXX
),但您正在设置一个C标志变量( hello_CFLAGS
)。
The matching variable for C++ is hello_CXXFLAGS
. C ++的匹配变量是hello_CXXFLAGS
。
That being said neither of those is the correct flag to use for this usage. 据说这两者都不是用于此用途的正确标志。 The correct flag (thanks ptomato) is hello_CPPFLAGS
. 正确的标志(感谢ptomato)是hello_CPPFLAGS
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.