Frage

I'm using QScintilla 2.8.
I have properly build the qscintilla2.dll.
I put it in my c:\Qt\Qt5.2.1\mingw48_32\bin folder

My path is the setup that Qt sets:

C:\Qt\Qt5.2.1\5.2.1\mingw48_32\lib;
C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin;
C:\Qt\Qt5.2.1\Tools\mingw48_32\bin;

In my project i put the following in my .pro file: LIBS += -lqscintilla2

In my code:

#include <Qsci/qsciscintilla.h>
#include <Qsci/qscilexerhtml.h>
#include <Qsci/qscilexerjavascript.h>
#include <Qsci/qscilexerxml.h>
#include <Qsci/qscilexercss.h>
#include <Qsci/qscilexersql.h>
#include <Qsci/qscilexeryaml.h>

...
QsciScintilla *editor = new QsciScintilla();

The program compiles fine. But when i run the program it crashes when it i step over:

QsciScintilla *editor = new QsciScintilla();

The error I see is in the Application output: QWidget: Must construct a QApplication before a QWidget Invalid parameter passed to C runtime function.

Also i get a message box that says: Microsoft Visual C++ Runtime Library This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Update 4/2/2014 - 11:17 PM I moved the code just to see it it made a difference if i initialize it right after the application first loads

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  MainWindow w;
  ..
}

so in MainWindow:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ...

    QsciScintilla *editor = new QsciScintilla();
    setCentralWidget(editor);

    ...
}

but it still fails with the same issues

Update 4/3/2014 - 8:32 PM OK I think I figured it out. When I build my project as a Release then everything works fine. Its when I use build my project as Debug that it fails. So maybe I need to build a debug version of QScintilla then

Any ideas. I've googled but nothing comes up.
Thanks

War es hilfreich?

Lösung

Update 4/3/2014 - 8:32 PM My solution is to build a debug version of the library and all works great. I used the following steps:

qmake qscintilla.pro
mingw32-make -f Makefile.Debug
mingw32-make -f Makefile.Debug install

Note: Make sure to copy the qscintilla2.dll to the bin directory of where all the libs are. In my case it in:

From:
C:\Qt\Qt5.2.1\5.2.1\mingw48_32\lib

To:
C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top