Use Google Test from Qt in Windows
        Posted  
        
            by Dave
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Dave
        
        
        
        Published on 2010-05-06T18:28:46Z
        Indexed on 
            2010/05/06
            18:48 UTC
        
        
        Read the original article
        Hit count: 599
        
qt
|googletest
I have a simple test file, TestMe.cpp:
#include <gtest/gtest.h>
TEST(MyTest, SomeTest) {
  EXPECT_EQ(1, 1);
}
int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}
I have Google Test built as a static library. (I can provide the makefile if it's relevant.)
I can compile TestMe.cpp from a command-line with no problem:
g++ TestMe.cpp -IC:\gtest-1.5.0\gtest-1.5.0\include -L../gtest/staticlib -lgtest -o TestMe.exe
It runs as expected.
However, I cannot get this to compile in Qt. My Qt project file, in the same directory:
SOURCES += TestMe.cpp
INCLUDEPATH += C:\gtest-1.5.0\gtest-1.5.0\include
LIBS += -L../gtest/staticlib -lgtest
This results in 17 "unresolved external symbol" errors related to gtest functions.
I'm pulling my hair out here, as I'm sure it's something simple. Any ideas?
© Stack Overflow or respective owner