Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
QVector<double> x(101), y(101); for (int i=0; i<101; ++i) { x[i] = i/50.0 - 1; y[i] = x[i]*x[i]; } QwtPlotCurve *curve; curve->setData(x,y); curve->attach(plot_all[0]);
假设plot_all[0]是我的 QwtPlot,这里有什么问题?它使我在 linux 中制作的程序崩溃。
plot_all[0]
您没有分配*curve,因此它不指向有效对象。尝试替换QwtPlotCurve *curve为
*curve
QwtPlotCurve *curve
QwtPlotCurve *curve = new QwtPlotCurve();