這是我第一次在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