Sunday, July 22, 2018

c++ - Couldn't build google mock



I tried to build google mock on Windows 7 by using MinGW. But I couldn't.



I downloaded google test and google mock from the web site below by clicking 'Download Zip' button.
[https://github.com/google/googletest][1]



I unzipped the file and execute the command on the command line.




> g++ -c -Iinclude -I. src/gmock-all.cc


But the error occurred.



> include/gmock/internal/gmock-port.h:53:45: fatal error: gtest/internal/gtest-linked_ptr.h: No such file or directory


How can I solve it?



Answer



You should first build googletest, and then googlemock. It comes bundled
with googlemock in subdirectory named "gtest". This is what you need to do:



g++ -isystem /include -I \
-isystem /include -I \
-pthread -c /src/gtest-all.cc
g++ -isystem /include -I \
-isystem /include -I \
-pthread -c /src/gmock-all.cc



This will definately work on Linux, but I cant be 100% sure for MinGW on
Win7. If it does not help, I suggest using Visual Studio Community Edition.
You already have a VS solution setup in /msvc/2010. It
is a solution for VS2010 but opening it with a newer version will prompt you
to upgrade the toolset. Simply accept and build the "gmock" project in that
solution.o_gmock>/src/gmock-all.cc


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...