Search code examples
c++googletestcatch2

What's the gtest equivalent of CATCH_CONFIG_MAIN?


#define CATCH_CONFIG_MAIN  // This tells Catch to provide a main() - only do this in one cpp file

I cannot find alternative of gtest after googling


Solution

  • According to their primer:

    But maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest_main library and you are good to go.

    So rather than asking for the library to generate a definition of main through a macro, you link in the gtest_main library which contains one.