Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 999
silent_coder Avatar asked Oct 14 '16 11:10

silent_coder


People also ask

How do I add a Google Test to a C++ project?

Add a Google Test project in Visual Studio 2019In Solution Explorer, right-click on the solution node and choose Add > New Project. Set Language to C++ and type test in the search box. From the results list, choose Google Test Project. Give the test project a name and choose OK.

Is Google Test header only?

Google Test is not header-only: there are libraries to build. So, as a Visual Studio user, you have essentially two options.


1 Answers

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.

like image 167
sehe Avatar answered Sep 21 '22 18:09

sehe