It's the first time I make mock object in QT. I'm trying using Gmock, but I don't know how to using it. Now, I create project TestGmock (QT Application) in QT, and I copy include folder in gmock-1.7.0 ( download it from https://code.google.com/) to TestGmock project directory ( and the same with gtest ). In class main :
#include <QCoreApplication>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
int main(int argc, char *argv[])
{
testing::InitGoogleMock (&argc, argv);
return RUN_ALL_TESTS();
}
But error :
- C:\Qt\Qt5.2.1\Tools\QtCreator\bin\TestGmock\main.cpp:6: error: undefined reference to `testing::InitGoogleMock(int*, char**)'
- C:\Qt\Qt5.2.1\Tools\QtCreator\bin\TestGmock\gtest\gtest.h:2288: error:undefined reference to `testing::UnitTest::GetInstance()'
- C:\Qt\Qt5.2.1\Tools\QtCreator\bin\TestGmock\gtest\gtest.h:2288: error:undefined reference to `testing::UnitTest::Run()' collect2.exe:-1:
- error: error: ld returned 1 exit status
Please help me using gmock and gtest in QT.