首页 > 解决方案 > C++:错误:无法在 stl_list.h 创建变量对象

问题描述

我有这个:

我的包括

#include<iostream>
#include <list>
#include <fstream>
#include <vector>
#include <sstream>
using namespace std;

崩溃的地方:

for (i = 0; i < j; i++){
    Actual = SPLITaVecINT(txtvec[i+1]);
    max = Actual.size(); 
    if (max != 1) {
        for (k = 0; k < porte; k++) {
            Grf.addEdge(Actual[0], Actual[k+1]); //**HERE IT CRASHES**
        }
    }
}
Grf.bridge();

addEdge 在这里,它使用双链表。

void Graph::addEdge(int v, int w)
{
    adj[v].push_back(w);
    adj[w].push_back(v);  // Note: the graph is undirected
}

因此,在 CLion 中进行调试时,它会转到第 1799 行的 stl_lib.h,在它旁边说“__position:0 __args#0:var-create:无法创建 var 对象”,同时突出显示第 1801 行。

看不到我的代码中的错误在哪里。请帮忙。

标签: c++listobjectvariables

解决方案


推荐阅读