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

我的梦境 提交于 2019-12-08 21:56:13

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/40042649/unit-test-from-google-test-no-longer-found-after-adding-header-with-boostfiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!