未知的警告来源:“找不到用于虚拟表...的链接器符号” [英] Unknown source of warning: "can't find linker symbol for virtual table for..."
问题描述
这是 main
方法:
int main(int argc,char * argv []){
if(argc!= 2){
cout<<< 错误:参数数量错误!... \\\
<< ENDL;
cout<<< \\\
<< Programm closed ... \\\
\\\
<< ENDL;
cin.ignore();
exit(1);
return 0;
}
cout<<< argv [1]<< argv [1]< ENDL;
GenericCommandConverter a(argv [1]);
a.getCommandsFromCSV();
cout<<< \\\
<< Programm finished ... \\\
\\\
<< ENDL;
return 0;
}
首次出现的代码: / p>
void GenericCommandConverter :: getATCommandsFromCSV(){
cout<< ++++++++++ getCommandsFromCSV+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ENDL;
string filename_csv =test.csv;
string commands =;
int pos_start = 0;
int pos_end = 0;
int substrLength = 0;
int separator_count = 0;
char c;
vector< string>线;
vector< string> commandList;
vector< unsigned int> parameterPositionList;
vector< vector< string> > linesSeparated;
vector< vector< string> > part1_input;
vector< vector< string> > part2_output;
vector< map< vector< string> ,矢量< string> > > listedParameterMap;
ifstream csvFile;
csvFile.open(filename_csv.c_str(),ios_base :: in);
cout<<< 我开始getCommandsFromCSV()... \\\
<< ENDL;
/ **
*步骤1
*将输入文本文件放入字符串
* /
if(csvFile.is_open()){
while(!csvFile.eof()){//< -------警告发生在这里!
csvFile.get(c);
命令+ = c;
}
...
}
警告:
[新主题2000.0x11bc]
警告:找不到用于
`std :: less< std :: vector< std :: basic_string< char,std :: char_traits< char>
的虚拟表的链接器符号的std ::分配器<炭> > std :: allocator< std :: basic_string< char,
std :: char_traits< char>,std :: allocator< char> > > > >'value
有没有人知道为什么会这样?它随着每一行直到它开始。它充满了控制台,以至于无法进行调试。
另一个可能重要的信息在独立模式下,此错误不显示。
我真的很感激一些帮助!
编辑:头文件
#ifndef CommandConverter_H_
#define CommandConverter_H_
#include< stdio.h>
#include< stdlib.h>
#include< fstream>
#include< iostream>
#include< sstream>
#include< string>
#include< iosfwd>
#include< map>
#include< vector>
#include< cstdio>
使用namespace std;
class CommandConverter {
public:
CommandConverter(char * file);
virtual〜CommandConverter();
void printConvertedTraceByPage(vector< string> lines);
map< string,vector< map< vector< string> ,矢量< string> > > > csvMap;
static const int MAX_SIZE = 5;
void getATCommandsFromCSV();
string readTxtFile();
vector< string> splitIntoLines(const char * trace);
vector< string> convert(vector< string> fileInLines);
bool commandAvailable(const char * l,int pos,const char * s);
void error(const char * p,const char * p2);
void printCSV();
//在构造函数中打开;关闭在析构函数
ifstream myfile;
string filename;
string trace_raw;
};
#endif / * CommandConverter_H_ * /
消息来自 gdb / gnu-v3-abi.c
中的此代码:
static struct type *
gnuv3_rtti_type(struct value * value,
int * full_p,int * top_p,int * using_enc_p)
{
.. 。
/ *符号的被清空的名称应该是vtable for
CLASS,其中CLASS是运行时类型为VALUE的名称。
如果我们不喜欢这种方法,我们可以看看
type_info对象本身来获取类名。但是,这样
应该同样适用,不会读取目标内存。 * /
vtable_symbol_name = SYMBOL_DEMANGLED_NAME(vtable_symbol);
if(vtable_symbol_name == NULL
|| strncmp(vtable_symbol_name,vtable for,11))
{
warning(_(找不到虚拟的链接符号%s值的表),
TYPE_NAME(values_type));
if(vtable_symbol_name)
warning(_(found%s代替),vtable_symbol_name);
返回NULL;
}
现在,我相当确定 std :: less
首先不应该有一个虚拟表,所以很可能GDB很困惑。
你需要验证最新的GDB存在问题,并提出错误。
由于最近才开始,您是否升级了GCC,GDB或更改的编译标志? p>
Since a few days I'm getting a warning msg while debugging. I can't find where it comes from. I was googleing already and found things like it's because I have a static variable. But taking it out doesn't change anything.
This is the main
method:
int main(int argc, char* argv[]) {
if (argc != 2) {
cout << "ERROR: Wrong amount of arguments!...\n"
<< endl;
cout << "\n" << "Programm closed...\n\n" << endl;
cin.ignore();
exit(1);
return 0;
}
cout << "argv[1] " << argv[1] << endl;
GenericCommandConverter a(argv[1]);
a.getCommandsFromCSV();
cout << "\n" << "Programm finished...\n\n" << endl;
return 0;
}
The code where it occures first time:
void GenericCommandConverter::getATCommandsFromCSV() {
cout << "+++++++++++getCommandsFromCSV) started++++++++++++++" << endl;
string filename_csv = "test.csv";
string commands = "";
int pos_start = 0;
int pos_end = 0;
int substrLength = 0;
int separator_count = 0;
char c;
vector<string> lines;
vector<string> commandList;
vector<unsigned int> parameterPositionList;
vector<vector<string> > linesSeparated;
vector<vector<string> > part1_input;
vector<vector<string> > part2_output;
vector<map<vector<string> , vector<string> > > listedParameterMap;
ifstream csvFile;
csvFile.open(filename_csv.c_str(), ios_base::in);
cout << "i'm starting getCommandsFromCSV()...\n" << endl;
/**
* STEP 1
* Putting input text file into a string
*/
if (csvFile.is_open()) {
while (!csvFile.eof()) { // <------- warning occurs here!
csvFile.get(c);
commands += c;
}
...
}
Warning:
[New Thread 2000.0x11bc]
warning: can't find linker symbol for virtual table for
`std::less<std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > >' value
Does anyone know why this is comming? It comes with each line until it started. It filles the console so much that it's not possible to debug. Another maybe important info on standalone mode this error is not displayed.
I really would appreciate some help!
EDIT: header file
#ifndef CommandConverter_H_
#define CommandConverter_H_
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <iosfwd>
#include <map>
#include <vector>
#include <cstdio>
using namespace std;
class CommandConverter {
public:
CommandConverter(char* file);
virtual ~CommandConverter();
void printConvertedTraceByPage(vector<string> lines);
map<string, vector<map<vector<string> , vector<string> > > > csvMap;
static const int MAX_SIZE = 5;
void getATCommandsFromCSV();
string readTxtFile();
vector<string> splitIntoLines(const char* trace);
vector<string> convert(vector<string> fileInLines);
bool commandAvailable(const char* l, int pos, const char* s);
void error(const char* p, const char* p2);
void printCSV();
// opened in constructor; closed in destructor
ifstream myfile;
string filename;
string trace_raw;
};
#endif /* CommandConverter_H_ */
The message comes from this code in gdb/gnu-v3-abi.c
:
static struct type *
gnuv3_rtti_type (struct value *value,
int *full_p, int *top_p, int *using_enc_p)
{
...
/* The symbol's demangled name should be something like "vtable for
CLASS", where CLASS is the name of the run-time type of VALUE.
If we didn't like this approach, we could instead look in the
type_info object itself to get the class name. But this way
should work just as well, and doesn't read target memory. */
vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
if (vtable_symbol_name == NULL
|| strncmp (vtable_symbol_name, "vtable for ", 11))
{
warning (_("can't find linker symbol for virtual table for `%s' value"),
TYPE_NAME (values_type));
if (vtable_symbol_name)
warning (_(" found `%s' instead"), vtable_symbol_name);
return NULL;
}
Now, I am fairly sure std::less
isn't supposed to have a virtual table in the first place, so it's likely that GDB is confused.
You'd need to verify that the problem exists with the latest GDB, and file a bug.
Since this only started recently, have you upgraded your GCC, GDB, or changed compilation flags?
这篇关于未知的警告来源:“找不到用于虚拟表...的链接器符号”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!