首页 > 解决方案 > 安装gtest的问题,由于巨大的错误无法编译

问题描述

make 时会发生大量编译错误。

我所做的逐项列出:我的操作逐项显示:

yum install git
yum install gcc-c++
yum install cmake
yum install python
yum install zeromq-devel

然后: git clone https://github.com/google/googletest.git

cd /googletest/googletest


[root@VM_16_11_centos googletest]# cmake CMakeLists.txt
 -- Configuring done
 -- Generating done
 -- Build files have been written to: 
 /usr/local/qiuxin/googletest/googletest
`[root@VM_16_11_centos googletest]# make
Huge Error here!!!
In file included from 
/usr/local/qiuxin/googletest/googletest/src/gtest-all.cc:38:0:
/usr/local/qiuxin/googletest/googletest/include/gtest/gtest.h: In 
member function 'virtual 
testing::Test::Setup_should_be_spelled_SetUp* 
testing::Test::Setup()': 

标签: compilationgoogletest

解决方案


解决了。我犯的错误是: 1) 我在 googletest/googletest 目录下创建了一个 build 文件夹。

正确的操作应该是:

在 googletest 目录(不是 googletest/googletest 目录)中创建一个构建文件夹。然后: cd build cmake .. -DBUILD_GTEST=ON -DBUILD_SHARED_LIBS=ON make sudo make install 一切顺利!


推荐阅读