mardi 29 novembre 2016

Using google test on windows with MSVC 2015

I have spent far too long trying to get GoogleTest working using MSVC 2015 so I'm hoping you clever SO guys can give me a hand.

What I've done:

  1. Cloned the GoogleTest github repo to my machine.
  2. Used CMake to generate MSVC project files. (I originally used the project files that come with the checkout, only to later find out after some searching that these do not appear to be complete and the CMake generated ones have apparently the correct defines etc

I can see that the sample tests compile fine in the CMake generate projects. However, on the project I have created for my own tests this is not the case. I've looked up just about every SO thread I can find and any other nuget of info... I have also made sure that between the CMake sample tests projects and my own that all the compiler and linker options are identical, so I'm at a total loss.

In my project I get the following compilation errros

Severity    Code    Description Project File    Line    Suppression State
Error   C2440   '<function-style-cast>': cannot convert from 'initializer list' to 'testing::internal::AssertHelper'    TestMpegMessing C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\src\gtest_binary_buffer.cpp  6   
Error   C2065   'gtest_ar': undeclared identifier   TestMpegMessing C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\src\gtest_binary_buffer.cpp  6   
Error   C2589   'switch': illegal token on right side of '::'   TestMpegMessing C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\src\gtest_binary_buffer.cpp  6   
Error   C2181   illegal else without matching if    TestMpegMessing C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\src\gtest_binary_buffer.cpp  6   
Error   C2228   left of '.failure_message' must have class/struct/union TestMpegMessing C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\src\gtest_binary_buffer.cpp  6   
Error   C2059   syntax error: '::'  TestMpegMessing C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\src\gtest_binary_buffer.cpp  6   

Has anyone had a similar problem? If not, I could do with a few tips on how on earth to further debug this.

Aucun commentaire:

Enregistrer un commentaire