Search code examples
c++unit-testingboostcmakegoogletest

Unit test from google test no longer found after adding header with boost::filesystem


I have a unittest project which using google test framework and my tests was working fine. However now I added boost::filesystem header like #include <boost/filesytem.hpp> and after that my project linking and compiling fine, however no tests found at all and when I run tests it's give me -

Process finished with exit code -1073741515 (0xC0000135) 
Empty test suite.

Like if I have this code:

#include <gtest/gtest.h>
TEST(Test, Test1){
    ASSERT_FALSE(true);
}

it works perfectly fine and find failed testcase, but if I add boost header like this:

#include <gtest/gtest.h>
#include <boost/filesystem.hpp>
TEST(Test, Test1){
    ASSERT_FALSE(true);
} 

after that nothing found. I use cmake/clion/cygwin based env. Will be appriciated for your ideas how to fix those problem.


Solution

  • The error code indicates

    //
    // MessageId: STATUS_DLL_NOT_FOUND
    //
    // MessageText:
    //
    // The program can't start because %hs is missing from your computer. 
    // Try reinstalling the program to fix this problem.
    //
    #define STATUS_DLL_NOT_FOUND             ((NTSTATUS)0xC0000135L)    // winnt
    

    (see What does error code 0xc0000135 mean when starting a .NET application?)

    My guess is you used Google test with a dynamic library to contain the tests. Since you added Boost Filesystem it will now be linked with Boost System and Boost Filesystem DLLs.

    However, the test runner cannot load these dependencies (leading to the error shown). Either install the boost DLLs system wide, copy them to the output directory for the test runner target (or wherever the testrunner is started) or use manifest files to indicate the DLL locations.

    UPDATE As the commenter added, of course NOT linking to the DLLs will also make the problem go away.