gmock
What did you do to solve gmock you mentioned (link enclosed)?
linking error when building Google test on mac (commandline) At the bottom, you wrote an edit about finding multiple gmock installations on the same computer messing up the include path for the compiler so it was hitting the old, 1.5 32 bit version instead of the right one. I installed mine via brew; brew install gmock, and it worked and everything-but I'm having the same problem you did. If you could just tell me how to compile it correctly like you mentioned in your post I'd be pleased enough to go and give you some upvotes, or you could just edit the link, and I would read it (please notify me when you do though). I have read the instructions on the googlemock google code page and what I downloaded in order to try and get things to build against it. I have searched around a lot, and I can't find anything that comes near as close as what you have talked about. To explain to you what I'm doing, I wrote a very simple test: http://codepad.org/zxBugY0w And when I tried to compile it with my locally included information I get: http://pastebin.com/fqEZ6zTq
Installing gtest via brew, or at all, isn't a supported configuration. The way gtest is intended to be used is for you to include it with a project and compile both together. Then, you link against your version, which is guaranteed to be compiled with the same settings. See http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog Also, note that you're getting a different error from the one in the question you linked to. That person got an error because they accidentally linked against a version that had been compiled with different settings. You're not linking against it at all (though you might see similar errors down the road if you continue with the brew configuration).
Actually, the problem was that I was not linking with a compiled version of the archive, the libgmock.a Once I linked, it worked just fine.
You need to link to gtest and gmock. In your g++ command, you need to add -L <full path to gtest lib> -L <full path to gmock lib> -lgmock -lgtest.
Related Links
gmock ReturnRef returns compilation error
How to call function pointer which is passed to Mock method?
In gmock, Is there a way to have mock object return an instance of an user defined object?
GMock testing destructor calls
set EXPECT_CALL to redirect the call to the original method
Capture GMOCK string parameter
Mocking non-virtual method generating errors
gmock matcher doesn't match my arguments by reference
What did you do to solve gmock you mentioned (link enclosed)?
how to set custom ref-variable in gmock