确定c++中包含符号的来源
Determining the source of an included symbol in C++
我目前正在做一个禁止包含c++标准库的项目。我们正在使用的编译文件之一列出了以下符号:_Xran__Q2_3std12_String_baseCFv
我相信这与标准库字符串有关。我这样想错了吗?如果没有,有没有人知道一种有效的方法来追踪这个符号被包含的点?粗略地搜索代码库不会发现任何明显的东西。
这似乎不是VC的混淆,它总是以问号开头。
但是,它符合g++的mangling方案,正如运行
所建议的那样$ c++filt --format=gnu "_Xran__Q2_3std12_String_baseCFv"
std::_String_base::_Xran( const(void))
奇怪的是,_Xran
似乎是VC对std::string
实现的一部分。
无论如何,你正在寻找的标题可能是#include <string>
。
EDIT:作为c++filt输出的结果-你确定它是在vc++中编译的吗?
如果string.h确实包含在某个地方,您可以找到在哪里:
在下一行#include
指令之后放置以下代码:
using namespace std;class string;struct{void hxtestfunc(void){typedef string hxtesttype;}};
编译时,只有当string.h(或任何直接或间接包含string.h的文件)在之前的某个地方包含时,才会生成"ambiguous symbol"错误。
因此,第一个报告的"ambiguous symbol"错误将引导您到关键包含之后的行。
在Visual c++中,你可以使用正则表达式:
代替" {# include。*}"
" nusing namespace std;class string;struct{void htestfunc(void){typedef string htesttype;}};"
相关文章:
- 'dlopen''ing 包含符号的 .so 会导致未定义的符号
- 是否可以将无符号字符数组reinterpret_cast到仅包含C++中无符号字符成员的结构指针
- 未定义的引用,即使库正在链接并且它包含正确的符号
- 如何对包含数字和符号的字符串进行排序?
- 如何将 32 位无符号整数分配给包含 32 位的位字段
- 如何在C 中正确定义包含科学符号的整数矢量
- Visual C :如何找到哪个标准库包含缺失的外部符号
- 当字符包含表情符号时如何比较字符?
- G++ 切换为不包含自己的符号函数名称(和调试数据)-
- 包含类文件后的错误消息(多个定义的符号)
- OpenNN在Visual Studio 2017中包含未解析的外部符号
- 无符号整数数组怎么可以包含负整数
- 将项目符号包含目录与 cmake 链接
- 包含MFC对象库时未解析的外部符号
- 什么是包含符号常数的结构的现代C++方法
- 最小的无符号整数,可以包含给定有符号积分的正值
- 带有正确包含保护的C++重复符号链接器错误
- 如何在python中将包含十六进制值的无符号char*数组写入文件
- 我是否应该对C++包含目录进行符号链接,以便它也出现在 /usr/include 下
- 通过符号链接包含共享库会导致未定义的引用