相关疑难解决方法(0)

C++:vector <string>*args = new vector <string>(); 导致SIGABRT

非常自我解释.这是导致'new vector'行上的SIGABRT的方法:

vector<string> * Task::arguments() {
    vector<string> *args = new vector<string>(); // CAUSES SIGABRT
    int count = sizeof(_arguments);
    for (int x = 0; x < count; x++) {
        string argument(_arguments[x]);
        args->push_back(argument);
    }
    return args;
}
Run Code Online (Sandbox Code Playgroud)

请注意,在其他地方我称之为确切的行没有任何问题.以下是Task类中包含的列表:

#include <vector>
#include <unistd.h>
#include <string>
using namespace std;
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

c++ new-operator stdvector sigabrt

3
推荐指数
1
解决办法
8712
查看次数

标签 统计

c++ ×1

new-operator ×1

sigabrt ×1

stdvector ×1