私はプログラムビルダークラスを書いています。セグメンテーションエラーが発生しました。
#ifndef BUILDER_H
#define BUILDER_H
#include
#include
#include
#include
class Builder : public QProcess
{
Q_OBJECT
public:
explicit Builder(QObject *parent = 0);
void loadSource(QString fpath);
bool isBuilded();
private:
QProcess* shell;
QString source;
QString path;
QString module;
signals:
void sourceLoaded();
void builded();
protected slots:
void build();
};
#endif//BUILDER_H
そして.cpp:
#include "builder.h"
Builder::Builder(QObject *parent) :
QProcess(parent)
{
connect(this,SIGNAL(sourceLoaded()),this,SLOT(build()));
connect(this,SIGNAL(finished(int)),this,SIGNAL(builded()));
}
void Builder::loadSource(QString fpath)
{
source = fpath;
QFileInfo info(source);
path = info.absoluteDir().absolutePath();
module = path+info.baseName();
emit sourceLoaded();
}
bool Builder::isBuilded()
{
if(QFile::exists(module))
return true;
return false;
}
void Builder::build()
{
QStringList argv;
argv << source;
start("g++",argv);
}
私のコードは、loadSource(QString)で与えるプログラムをコンパイルする必要があります。
私がstart()を開始するとき、関数プログラムはSISSEGVシグナルを返します。私はエラーが表示されません。