c++ Autotools Google测试框架

C++ Autotools Google test framework

本文关键字:框架 测试 Google Autotools c++      更新时间:2023-10-16

我正在尝试使用autotools将Google测试框架添加到我的应用程序。但是我有一些奇怪的错误。在configure.ac:

AC_CHECK_HEADER([gtest/gtest.h], [AC_DEFINE([HAVE_GTEST_H], 1)])

但是在log中我得到:

...
checking for limits.h... yes
checking gtest/gtest.h usability... no
checking gtest/gtest.h presence... no
checking for gtest/gtest.h... no

config.log:

configure:3276: checking gtest/gtest.h presence
configure:3276: gcc -E  conftest.c
In file included from conftest.c:19:0:
/usr/include/gtest/gtest.h:54:18: fatal error: limits: No such file or directory
compilation terminated.

两个文件都存在。我知道/usr/include是默认的include

<limits>是一个c++头,这可能意味着gtest.h是一个c++头,这意味着谷歌测试框架是用c++编写的。您需要使用c++编译器来检测头文件的可用性。

关于如何使用autotools解决这个问题的详细信息,请参阅答案