c – 未知警告源:“找不到虚拟表的链接器符号…”

几天后我在调试时收到警告消息.我找不到它的来源.我已经谷歌了,发现了类似的东西,因为我有一个静态变量.但是把它取出并没有改变任何东西.

这是主要方法:

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

第一次出现的代码:

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

...

}

警告:

[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

有谁知道为什么会这样?每条线都有它,直到它开始.它完全填满了控制台,无法进行调试.
另一个可能是独立模式的重要信息,不会显示此错误.

我真的很感激一些帮助!

编辑:头文件

#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_ */
最佳答案
该消息来自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;
    }

现在,我相当确定std :: less不应该首先拥有虚拟表,因此很可能GDB很困惑.

您需要验证最新GDB存在问题,并提交错误.

由于这只是最近才开始的,您是否升级了GCC,GDB或更改了编译标志?

转载注明原文:c – 未知警告源:“找不到虚拟表的链接器符号…” - 代码日志