You are not logged in.
Hello!
I'm using Arch Linux with QtCreator 3.4.2 Based on Qt 5.5.0 (GCC 5.1.0, 64 bit). So, i want to learn about OpenGL programming. To do that i installed "freeglut, mesa, mesa-demos, mesa-libgl, openal, glew". I tried make a program to show me an OpenGL example using QtCreator, but the program starts and close immediately, i don't see nothing and QtCreator doesn't show my any errot message but:
Starting /home/rob/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test...
The program has unexpectedly finished.
/home/rob/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test crashed
I launched the software using terminal and i got this:
> cd Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/
> ./Test
Segmentation fault (core dumped)
I tried to ask help in qtforum but they dind't help me and i don't know what to do!
Here my code:
//Test.pro
#-------------------------------------------------
#
# Project created by QtCreator 2015-08-18T11:40:04
#
#-------------------------------------------------
QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
glwidget.cpp
HEADERS += mainwindow.h \
glwidget.h
FORMS += mainwindow.ui
LIBS += -lglut
//glwidget.h
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include <QObject>
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
//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 slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
//glwidget.cpp
#include "glwidget.h"
#include "GL/glut.h"
GLWidget::GLWidget(QWidget *parent) {
}
void GLWidget::initializeGL( ) {
glClearColor(0.2, 0.2, 0.2, 1);
}
void GLWidget::paintGL( ) {
glClear( GL_COLOR_BUFFER_BIT );
glRotatef(0.5, 1, 1, 1);
glutWireTeapot( 0.6 );
}
void GLWidget::resizeGL(int w, int h) {
}
//mainwindow.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;
}
void MainWindow::on_pushButton_clicked( ) {
}
//main.cpp
#include "mainwindow.h"
#include "GL/glut.h"
#include <QApplication>
int main(int argc, char *argv[]) {
glutInit(&argc, argv);
QApplication a(argc, argv);
MainWindow w;
w.show( );
return a.exec( );
}
How can i fix this?
Thanks!
Last edited by claudiogc (2015-08-26 01:21:52)
Offline
First, moving to Programming and Scripting.
Second, use coredumpctl to find all of the core dumps you've had of late. Then, use coredumpctl gdb <filename> to load the most recent core dump under gdb. I think it will be coredumpctl gdb Test. You may need to provide the full path provided by coredumpctl. Then, inside gdb, post the output of the directive bt (Back trace). It will tell you what failed, and how you got there. Post that information here.
Last edited by ewaller (2015-08-26 03:43:12)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Thanks for your answer. Here the output of what you said to do.
> coredumpctl
TIME PID UID GID SIG PRESENT EXE
Tue 2015-07-28 12:07:30 BRT 523 1000 100 11 /usr/bin/nautilus
Sat 2015-08-01 09:57:25 BRT 1730 1000 100 11 /usr/lib/firefox/plugin-container
Sat 2015-08-01 09:57:30 BRT 447 1000 100 11 /usr/lib/firefox/firefox
Sun 2015-08-02 21:19:24 BRT 5138 1000 100 6 /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Mon 2015-08-03 00:42:51 BRT 2133 1000 100 6 /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Mon 2015-08-03 00:43:02 BRT 2155 1000 100 6 /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Mon 2015-08-03 01:00:37 BRT 3529 1000 100 6 /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Mon 2015-08-03 01:00:52 BRT 3558 1000 100 11 /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Mon 2015-08-03 02:19:26 BRT 10108 1000 100 6 /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
> coredumpctl gdb /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
PID: 1896 (Test)
UID: 1000 (rob)
GID: 100 (users)
Signal: 11 (SEGV)
Timestamp: Sun 2015-08-30 22:42:07 BRT (3 days ago)
Command Line: /home/rob/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Executable: /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
Control Group: /user.slice/user-1000.slice/session-c1.scope
Unit: session-c1.scope
Slice: user-1000.slice
Session: c1
Owner UID: 1000 (rob)
Boot ID: 84cddb75f70e46d6b450ed04ce55c528
Machine ID: 7900589001924a1b9bc22f24eb9db916
Hostname: archrob
Message: Process 1896 (Test) of user 1000 dumped core.Cannot retrieve coredump from journal nor disk.
Failed to retrieve core: No such file or directory
> cd Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/
> gdb Test
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Test...done.
(gdb) start
Temporary breakpoint 1 at 0x4038e6: file ../Test/main.cpp, line 6.
Starting program: /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".Temporary breakpoint 1, main (argc=1, argv=0x7fffffffeac8) at ../Test/main.cpp:6
6 glutInit(&argc, argv);
(gdb) bt
#0 main (argc=1, argv=0x7fffffffeac8) at ../Test/main.cpp:6
I have no idea what to do!
Offline
And here, the output of "bt full" command:
(gdb) run
Starting program: /media/Backup/Programming/C-C++/Linux/Qt/build-Test-Desktop-Debug/Test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe65dd700 (LWP 2817)]
[New Thread 0x7fffe9444700 (LWP 2815)]Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b3cd06 in fghDrawGeometryWire () from /usr/lib/libglut.so.3
(gdb) bt full
#0 0x00007ffff7b3cd06 in fghDrawGeometryWire () from /usr/lib/libglut.so.3
No symbol table info available.
#1 0x00007ffff7b47a70 in ?? () from /usr/lib/libglut.so.3
No symbol table info available.
#2 0x00007ffff7b48322 in glutWireTeapot () from /usr/lib/libglut.so.3
No symbol table info available.
#3 0x0000000000404809 in GLWidget::paintGL (this=0x6c15a0) at ../Test/glwidget.cpp:15
No locals.
#4 0x00007ffff78e78e4 in QGLWidget::glDraw() () from /usr/lib/libQt5OpenGL.so.5
No symbol table info available.
#5 0x00007ffff78e728d in QGLWidget::paintEvent(QPaintEvent*) ()
from /usr/lib/libQt5OpenGL.so.5
No symbol table info available.
#6 0x00007ffff71cef08 in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#7 0x00007ffff718c00c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#8 0x00007ffff71914e6 in QApplication::notify(QObject*, QEvent*) ()
from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#9 0x00007ffff645289b in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
from /usr/lib/libQt5Core.so.5
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#10 0x00007ffff71c7b39 in QWidgetPrivate::sendPaintEvent(QRegion const&) ()
from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#11 0x00007ffff71c8181 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#12 0x00007ffff7197c02 in QWidgetPrivate::repaint_sys(QRegion const&) ()
from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#13 0x00007ffff71ebc03 in ?? () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#14 0x00007ffff718c00c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#15 0x00007ffff71914e6 in QApplication::notify(QObject*, QEvent*) ()
from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#16 0x00007ffff645289b in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
from /usr/lib/libQt5Core.so.5
No symbol table info available.
#17 0x00007ffff69b2c7c in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#18 0x00007ffff69b39fd in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystem---Type <return> to continue, or q <return> to quit---
InterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#19 0x00007ffff6998e38 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#20 0x00007fffe83fa6b0 in ?? () from /usr/lib/libQt5XcbQpa.so.5
No symbol table info available.
#21 0x00007ffff424a9fd in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#22 0x00007ffff424ace0 in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#23 0x00007ffff424ad8c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#24 0x00007ffff64a923f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#25 0x00007ffff645026a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
from /usr/lib/libQt5Core.so.5
No symbol table info available.
#26 0x00007ffff645820c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#27 0x0000000000403934 in main (argc=1, argv=0x7fffffffeac8) at ../Test/main.cpp:11
a = <incomplete type>
w = {<QMainWindow> = {<No data fields>}, static staticMetaObject = {d = {
---Type <return> to continue, or q <return> to quit---
superdata = 0x7ffff78aeee0 <QMainWindow::staticMetaObject>,
stringdata = 0x404c60 <qt_meta_stringdata_MainWindow>,
data = 0x404ce0 <qt_meta_data_MainWindow>,
static_metacall = 0x40481e <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}},
ui = 0x6c0ed0}
Offline
I think it's not that easy to use Qt with GLUT, since GLUT uses its own rendering loop. Here someone suggest to run GLUT loop in a different thread to the main one, in this case he is mixing GLUT and GTK.
Offline
I think it's not that easy to use Qt with GLUT, since GLUT uses its own rendering loop. Here someone suggest to run GLUT loop in a different thread to the main one, in this case he is mixing GLUT and GTK.
Thanks! I tried, but did no work.
What other options do i have?
I want to make a program that reads an txt file and based on their content, draws a xy graph. I did my UI and all the rest with qtcreator, this is the last part, draw a xy graph.
Offline
Just avoid all code related to GLUT. This tutorial in particular explains very well how to load a mesh in OpenGL and doesn't requires GLUT. This also explains how to export your models from Blender. And this is specific for Qt.
Last edited by hipersayan_x (2015-09-09 03:16:09)
Offline
Just avoid all code related to GLUT. This tutorial in particular explains very well how to load a mesh in OpenGL and doesn't requires GLUT. This also explains how to export your models from Blender. And this is specific for Qt.
But you understand i don't want to use Blender or make 3d stuff. Just a xy graph. Or if there is another option for doing that please, tell me.
Thanks for your answer!
Offline
I found this website, i'll try to use it because that's what i want to do and as soon as i can i post here.
Offline
Just a xy graph.
Ops sorry, i did not read that.
Offline