我在尝试安装Google C++ Mocking Framework时遇到了困难。我已经成功运行了
使用
我猜链接器找不到库文件。有人知道怎么解决吗?
sudo apt-get install google-mock
命令。然后我尝试编译这个示例文件。#include "gmock/gmock.h"
int main(int argc, char** argv) {
::testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
使用
g++ -lgmock main.cpp
命令时出现了以下错误。main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleMock(int*, char**)'
main.cpp:(.text+0x23): undefined reference to `testing::UnitTest::GetInstance()'
main.cpp:(.text+0x2b): undefined reference to `testing::UnitTest::Run()'
collect2: error: ld returned 1 exit status
我猜链接器找不到库文件。有人知道怎么解决吗?