我正在尝试将rapidcheck集成到现有的C ++代码库中。 README表示它需要C ++ 11并且在很大程度上依赖于它的功能。现有的代码库使用automake来构建所有依赖项。以下是我将依赖项添加到configure.ac
:
CXXFLAGS="$CXXFLAGS -Wall -Werror -Wno-missing-braces -std=c++11"
CXXFLAGS="$CXXFLAGS -I/home/chris/dev/rapidcheck/include"
CXXFLAGS="$CXXFLAGS -I/home/chris/dev/rapidcheck/include/rapidcheck"
AC_CHECK_HEADERS(
[rapidcheck.h],
[AC_CHECK_LIB([rapidcheck], [main],[], [])],
[])
以下是运行configure脚本时出现的错误:
checking rapidcheck.h usability... yes
checking rapidcheck.h presence... no
configure: WARNING: rapidcheck.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: rapidcheck.h: proceeding with the compiler's result
checking for rapidcheck.h... yes
checking for main in -lrapidcheck... no
config.log
3501 configure:22873: checking rapidcheck.h usability
3502 configure:22873: g++ -std=c++11 -c -g -O2 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wall -Werror -Wno-missing-braces -std=c++11 -I/home/chris/dev/rapidcheck/include -I/home/chris /dev/rapidcheck/include/rapidcheck -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS conftest.cpp >&5
3503 configure:22873: $? = 0
3504 configure:22873: result: yes
3505 configure:22873: checking rapidcheck.h presence
3506 configure:22873: g++ -std=c++11 -E -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS conftest.cpp
3507 conftest.cpp:58:24: fatal error: rapidcheck.h: No such file or directory
3508 compilation terminated.
我认为这与没有最新的C ++编译器有关。
以下是我安装的C ++版本:
chris@chris:~/dev/bitcoin$ g++ --version
g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
哪个我认为与C ++ 11兼容。
答案 0 :(得分:1)
这与automake
无关,与autoconf
有关。
特别是,您应该能够忽略此警告,因为autoconf比预处理器更好地接受编译器输出。正如有人在评论中已经说过的那样,CPPFLAGS
应该用于为预处理器传递-I
标志以找到标题,但在这种情况下,鉴于那些标志,它真的不那么重要不应该在configure.ac
中设置(而是从外部传递,因为安装位置是由用户定义的。)