I can add via visual studio 2017 a googletest project to my solution. When I do this, it generates automatically a new project with a sample test. And adds a nuget package of
Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.
Now this test has no main. But it creates an Executable and I can run it.
#include "pch.h"
TEST(TestCaseName, TestName) {
EXPECT_EQ(1, 1);
EXPECT_TRUE(true);
}
After implement some tests and removing the nuget (but not as a direct result of removing it), the compiler on jenkins needs a main. After implementing the main everything works fine.
I am curious how this work (create an executable without declaring a main). Does googletest is shipped with a default main if there can not be found any other? And how I crashed it or why this suddenly can not be found?
Gtest has "gtest_main" library that implements application entry point and runs test. Uness you link that library you will need to provide entry point yourself. See Writing the main() Function