Use Google Test from Qt in Windows

后端 未结 3 1367
终归单人心
终归单人心 2021-02-08 15:45

I have a simple test file, TestMe.cpp:

#include 

TEST(MyTest, SomeTest) {
  EXPECT_EQ(1, 1);
}

int main(int argc, char **argv) {
  ::testi         


        
3条回答
  •  遇见更好的自我
    2021-02-08 16:18

    I'm using Qt + gtest/gmock without any issues. I've just tested all possible combinations of absolute/relative paths with different slashes, but I couldn't reproduce your problem. Have you checked the contents of "LIBS" variable from Makefile.Debug generated by qmake?

    Here's some generic piece of advice: don't use any absolute paths, because your code won't compile on other machines than your own, unless you'll download it to exacly same location (which might not be possible due to different Qt setup, etc.). Use relative paths instead, also for 3rd party libs.

    I keep the 3rd party libraries in version control system (you use one, right?). I have a "3rdparty" directory and for each project that uses those libs, I add svn:external property pointing to explicitly specified version of 3rd party lib. The last part is important, because it ensures that you'll be able to build every revision of your project, even when you update 3rd party library.

提交回复
热议问题