dmateer
7th May 2010, 22:04
I have a simple Qt project that is using the Google Test framework. When I compile and run my main.cpp using g++, everything works. However, when I compile and run using Qt, there is no output. There are no errors; the program immediately exits with code 0. It almost seems like my output is just getting lost. I get the same (non)output whether running from Qt Creator or starting the application from a command line.
Here is what works:
g++ -I../../inc -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -g -Wall -Wextra -c main.cpp
g++ -o tests main.o -LC:\gtest-1.5.0\gtest-1.5.0\make -lgtest_dll
Here is my Qt pro file:
DEFINES += GTEST_LINKED_AS_SHARED_LIBRARY=1
SOURCES += main.cpp
INCLUDEPATH += ../../inc
LIBS += -LC:\gtest-1.5.0\gtest-1.5.0\make -lgtest_dll
My main.cpp follows, although I know that it is fine because when I compile outside of Qt, it is working:
#include <gtest/gtest.h>
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
TEST(SomeTest, SomeTestTest)
{
ASSERT_EQ(1,1);
}
Here is what works:
g++ -I../../inc -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -g -Wall -Wextra -c main.cpp
g++ -o tests main.o -LC:\gtest-1.5.0\gtest-1.5.0\make -lgtest_dll
Here is my Qt pro file:
DEFINES += GTEST_LINKED_AS_SHARED_LIBRARY=1
SOURCES += main.cpp
INCLUDEPATH += ../../inc
LIBS += -LC:\gtest-1.5.0\gtest-1.5.0\make -lgtest_dll
My main.cpp follows, although I know that it is fine because when I compile outside of Qt, it is working:
#include <gtest/gtest.h>
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
TEST(SomeTest, SomeTestTest)
{
ASSERT_EQ(1,1);
}