1

I am trying to compile and use Google test for my project. I have created .sln and .vcproj files successfully using CMake. Compilation was also successful of the .sln file. But, when I try to follow steps as pointed out in the "nonsensical101"-s answer as below: How to setup Google C++ Testing Framework (gtest) on Visual Studio 2005 I see that there is no "gtestd.lib" on my computer at all. Why??? That is also the error I get then when I try to compile a sample program.

Error:

Error 1 error LNK1104: cannot open file 'gtestd.lib' C:\Documents and Settings\User\my documents\visual studio 2010\Projects\String_GTest\String_GTest\LINK

ps. I am using Visual Studio 10.

Community
  • 1
  • 1
pseudonym_127
  • 357
  • 7
  • 16

1 Answers1

0

Google's C++ Test Framework has two output libraries: one is gtest.lib and the other one is gtest_main.lib. According to Nik Reiman's answer on How to setup Google C++ Testing Framework (gtest) on Visual Studio 2005, if you dont have these, it means you did not compiled it successfully...

Community
  • 1
  • 1
Saqlain
  • 17,490
  • 4
  • 27
  • 33
  • Aha, no I have found it, it is on my: D:/MyBuild/Debug/gtest.lib - but there was no gtestd.lib... bTw. Why are Nik Reiman and nonsensical101 referring to different .libs? No, I think gtest.lib abd gtest.d lib are for Release and Debug modes respectively, isn't it?? (e.g., as in Nik Reiman's answer: "You then link against gtest.lib/gtest_main.lib in your Release build and gtestd.lib/gtest_maind.lib in your Debug build.") – pseudonym_127 Apr 04 '13 at 10:41
  • Hi, btw, now I successfully managed to run the test program, but I have specified gtest.lib instead of gtestd.lib as in steps 6,7 of nonsensical101's answer on: http://stackoverflow.com/questions/531941/how-to-setup-google-c-testing-framework-gtest-on-visual-studio-2005/4222169# and I am building in Debug mode. Do you think I am doing something wrong? Thank you. – pseudonym_127 Apr 04 '13 at 11:00
  • "Do you think I am doing something wrong" - No. Follow suggestions given by nonsensical101 in his/her post. In the end, most of the successful Gtest builds around Internet used its information. – SChepurin Apr 04 '13 at 11:20
  • Hi Schepurin, thanks. The thing is the only thing I did different as compared to nonsensical101's answer is that I used gtest.lib instead of gtestd.lib in steps 6 and 7 of his answer. That is why I asked if what I did was correct (but still in the end I managed to run the test program nonsensical101 has given in his post). – pseudonym_127 Apr 04 '13 at 11:36