使用boost :: filesystem添加标头后,再也找不到来自Google测试的单元测试 [英] Unit test from google test no longer found after adding header with boost::filesystem

查看:105
本文介绍了使用boost :: filesystem添加标头后,再也找不到来自Google测试的单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Google测试框架的单元测试项目,我的测试工作正常.但是,现在我添加了boost::filesystem标头,如#include <boost/filesytem.hpp>,之后我的项目链接和编译正常,但是根本没有找到测试,当我运行测试时,它给了我-

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);
}

它工作得很好,并找到了失败的测试用例,但是如果我这样添加boost标头:

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);
} 

之后,什么也没找到.我使用基于cmake/clion/cygwin的环境.将适用于您的想法如何解决这些问题.

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

推荐答案

错误代码指示

//
// 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

(请参阅什么是错误代码0xc0000135 .NET应用程序启动时是什么意思?)

我的猜测是您使用带有动态库的Google测试来包含测试.自从添加了Boost Filesystem之后,它现在将与Boost System和Boost Filesystem DLL链接.

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.

但是,测试运行程序无法加载这些依赖项(导致显示错误).可以在整个系统上安装boost DLL,将它们复制到测试运行器目标的输出目录(或启动测试运行器的位置),或使用清单文件指示DLL的位置.

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.

更新正如评论者所添加的,当然,不链接到DLL也会使问题消失.

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

这篇关于使用boost :: filesystem添加标头后,再也找不到来自Google测试的单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆