简体   繁体   中英

Basic qt app doesn't run but compilied

I have created simple qt application: just bare widget. It compilied well, without any problems. Compilied as follows:

mingw32-make -j5 -f Makefile.Release mingw32-make[1]: Entering directory C:/Users/juriy/test' g++ -c -pipe -O2 -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../Qt/4.8.6/include/QtCore' -I'../../../Qt/4.8.6/include/QtGui' -I'../../../Qt/4.8.6/include' -I'../../../Qt/4.8.6/include/ActiveQt' -I'release' -I'.' -I'../../../Qt/4.8.6/mkspecs/win32-g++' -o release/main.o main.cpp

When I starts the application in QtCreator it goes under debug like this:

Debugging starts
Debugging has failed
Debugging has finished

without debugging mode like this:

Starting C:\Users\juriy\test\release\test.exe...
The program has unexpectedly finished.
C:\Users\juriy\test\release\test.exe crashed

Under GDB:

GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-mingw32"...
BFD: BFD (GNU Binutils) 2.18.50.20080226 internal error, aborting at coffcode.h line 842 in handle_COMDAT

BFD: Please report this bug.

It seems like I use wrong tools for such a version of Qt. My tools: whole toolchain from QtSDK 1.2.1 and Qt 4.8.6 .

I tryed Cygwin packages make and MinGW binutils , but it abused by lack of cc1plus option -fno-keep-inline-dllexport . Please, help to understand dependencies of tools and run the application.

Is it right message that gdb was configured as i686-pc-mingw32 as it pointed above? There is two environments Cygwin and native Windows in my PC. And theres is no like i686-pc-ming32 names in C:\\QtSDK\\mingw\\bin , but simple names as ar.exe , c++filt.exe etc. Form like i686-*-mingw32-* has programs in Cygwin env.

EDIT: (Записи в журнале сообщений Windows)

Имя сбойного приложения: test.exe, версия: 0.0.0.0, отметка времени: 0x55912535
Имя сбойного модуля: QtCored4.dll, версия: 4.8.6.0, отметка времени 0x00000000
Код исключения: 0xc0000005
Смещение ошибки: 0x00106acf
Идентификатор сбойного процесса: 0x1340
Время запуска сбойного приложения: 0x01d0b26aab6adef8
Путь сбойного приложения: C:\Users\juriy\test\debug\test.exe
Путь сбойного модуля: C:\Qt\4.8.6\bin\QtCored4.dll
Код отчета: ec353438-1e5d-11e5-b20d-f46d04d35ed7

EDIT: Some source to clarify situation.

//widget.h
namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private:
    Ui::Widget *ui;
};
//widget.cpp
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

// main.cpp
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();

    return a.exec();
}

It is important to use the same version of compiler that library was built. Here information about which version was used for building qt libraries. Some useful sites that follow me to this decision: qt centre forum and another one .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM