这是我第一次在QT中制作模拟对象。我正在尝试使用Gmock,但我不知道如何使用它。 现在,我在QT中创建项目TestGmock(QT应用程序),并将gmock-1.7.0中的include文件夹(从https://code.google.com/下载)复制到TestGmock项目目录(和gtest相同)。在主类:在QT中配置gmock
#include <QCoreApplication>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
int main(int argc, char *argv[])
{
testing::InitGoogleMock (&argc, argv);
return RUN_ALL_TESTS();
}
但是错误:
- C:\ Qt的\ Qt5.2.1 \工具\ QtCreator \ BIN \ TestGmock \ main.cpp中:6:错误:未定义参考`测试:: InitGoogleMock(int *,char **)'
- C:\ Qt \ Qt5.2.1 \ Tools \ QtCreator \ bin \ TestGmock \ gtest \ gtest.h:2288:error:未定义对`testing :: UnitTest的引用:: GetInstance()'
- C:\ Qt \ Qt5.2.1 \ Tools \ QtCreator \ bin \ TestGmock \ gtest \ gtest.h:2288:error:undefined引用到`testing :: UnitTest :: Run()' collect2.exe:-1:
- 错误:错误:LD返回1个退出状态
使用gmock和GTEST在QT,请帮帮我。
我使用3.0.1 – 2014-10-01 03:27:55