Qt opengl调试SIGSEGV如何修复
Qt-opengl-debug-SIGSEGV-how to fix?
我遵循以下教程:https://www.youtube.com/watch?v=1nzHSkY4K18
1/test_opengl.pro
==============================================
QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test_opengl
TEMPLATE = app
SOURCES += main.cpp
mainwindow.cpp
glwidget.cpp
HEADERS += mainwindow.h
glwidget.h
FORMS += mainwindow.ui
========================================
2/glwidget.h
========================================
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
class GLWidget : public QGLWidget
{
Q_OBJECT
public:
explicit GLWidget(QWidget *parent = 0);
void initializeGL();
void paintGL();
void resizeGL(int w, int h);
};
#endif // GLWIDGET_H
=============================================
3/mainwindow.h
=============================================
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
=============================================
4/glwidget.cpp
=============================================
#include "glwidget.h"
GLWidget::GLWidget(QWidget *parent) :
QGLWidget(parent)
{
}
void GLWidget::initializeGL()
{
}
void GLWidget::paintGL()
{
}
void GLWidget::resizeGL(int w, int h)
{
}
=============================================
5/main.cpp
=============================================
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
=============================================
6/主窗口.cpp
=============================================
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
=============================================
7/mainwindow.ui
=============================================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>365</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Opengl</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="GLWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>&Quit</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>GLWidget</class>
<extends>QWidget</extends>
<header>glwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>383</x>
<y>342</y>
</hint>
<hint type="destinationlabel">
<x>390</x>
<y>230</y>
</hint>
</hints>
</connection>
</connections>
</ui>
=============================================
调试时,我得到了:
由于接收到来自操作系统的信号,下位机停止运行。
信号名称:SIGSEGV
信号含义:分段故障
这个在Disassembler上??
0x143d1fa6----------------83 80 40 01 00 00 ff----------------addl-----$0xfffffff,0x140(%eax)
关于";"非法访问存储器"未初始化指针"我该怎么修?我使用Qt5.3.2,明,窗口7 32位。我的屏幕:http://postimg.org/image/pspg5e0g7/
我认为我的驱动程序有问题,我试图删除并设置Qt,但版本较旧(Qt 4.8.6),它已经运行。
- 静态数据成员的问题-修复链接错误会导致编译器错误
- Boost Graph Library,修复节点大小
- 函数何时会在c++中包含stack_Unwind_Resume调用
- 如何修复此错误:未定义对"距离(浮点数,浮点数,浮点数,浮点数,浮点数)"的引用
- 如何修复函数样式强制转换或类型构造的预期"("?
- 如何针对特定情况调试和修复此双自由内存损坏问题
- 创建LinkedList退出,返回代码为-11(SIGSEGV)
- 当使用带有VS2019或VSCode的虚幻引擎4.24.2时,我如何修复这些错误的Intellisense错误
- 如何修复sfml c++代码编译错误
- Python中的for循环与C++有何不同
- 如何修复此iFile以将.txt输出到控制台
- 我收到同义重复编译器错误。我应该如何修复"类型"X"的参数与类型"X"的参数不兼容?
- 如何修复链表类实现的未处理异常0xDDDDDDDD
- 如何修复此错误:className::className的无效使用
- 叮叮当当在修复时插入多个"覆盖"说明符
- 如何修复带有 clang 的参数'args'缺少默认参数的问题?
- 哪个部分导致"SIGSEGV"错误以及如何修复它?
- 为什么我在尝试将字符传递给我的函数以及如何修复它时会获得 SIGSEGV
- Qt opengl调试SIGSEGV如何修复
- 分段故障错误(信号名称:SIGSEGV)的原因是什么,以及如何查找/修复它