当我尝试构建测试源时,我得到一个类似的错误。
stl_tree.h:542:14: 错误: '__node' 没有命名类型 ::new(__node) _Rb_tree_node<_Val>;
执行者的内容。
#include <CppUTest/TestHarness.h>
#include <CppUTest/CommandLineTestRunner.h>
#include <CppUTest/UtestMacros.h>
#include <CppUTestExt/MockSupport.h>
int main(int argc, char** argv) {
MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
return CommandLineTestRunner::RunAllTests(argc, argv);
}
我的测试的源代码以以下包括开头。
#include <CppUTest/TestHarness.h>
#include <CppUTest/CommandLineTestRunner.h>
#include <CppUTest/UtestMacros.h>
#include <CppUTestExt/MockSupport.h>
#include <iostream>
#include "common/data_util_astro_cfg.h"
TEST_GROUP(ASTRO_UTIL_TEST) {
void setup() { }
void teardown() { }
};
“common/data_util_astro_cfg.h”文件包含以下内容。
#include "../data/data_type_file.h"
#include <json/json.h>
static AstroConfigs toAstroConfigs(std::string content)
我的问题是我得到了这些包含的编译错误,当我删除行 json.h include 一切都很好我可以获得二进制输出。
我认为问题在于新运营商的冲突。该解决方案由 Cpputest 方提供,位于http://cpputest.github.io/manual.html#memory_leak_detection。但不知何故还不清楚。:(
包含 <map> 后,该问题已在编译错误中定义。它与我的非常相似,但问题已通过创建新项目解决。在那种情况下,我别无选择。我正在使用 Yocto 项目,该项目也使用自动生成工具创建。
你能帮我解决这个问题吗?(感谢您的时间。)