Jump to content
  • Advertisement
Sign in to follow this  
jeff8j

QT Program Help

This topic is 2095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im compiling a simple qt program with mingw and it crashes on qapplication and I cannot figure out why?

 

I have tried debug and release libraries manually setting the argc and argv which I believe its getting hung up on thats the only variables qt is getting but no matter what I do it has the same issue. I have also tried different qt versions everywhere from 5.0.0 to 5.2 with no change.

 

Heres my source

#include <iostream>
#include <Qt>
#include <QCoreApplication>
#include <QApplication>
#include <QtWebKitWidgets/QWebView>
#include <QtWebKitWidgets/QWebFrame>
#include <QImage>
#include <QWebPage>


int main(int argc, char** argv){
    std::cout << "here1" << std::endl;
    std::cout << "argc: " << argc << std::endl;
    QApplication app(argc, argv);
    std::cout << "here2" << std::endl;
    QWebView* view = new QWebView();
    std::cout << "here3" << std::endl;

    view->resize(800,600);
    view->load(QUrl("http://www.google.com"));
    view->show();

    return app.exec();
}

Heres how its compiled

i686-w64-mingw32-g++ -Ofast -Wall -o test/testwin32.exe test.cpp  -static-libgcc -static-libstdc++ -lgdi32 -lopengl32 -lglu32 -lws2_32 -lpdh -lpsapi -Wl,-rpath='$ORIGIN/',-rpath='.',-rpath='../',-rpath='resources/win32/qtwebkit/',-rpath='./resources/win32/qtwebkit/' -I./5.0.1/mingw47_32/include -I./5.0.1/mingw47_32/include/QtWidgets -I./5.0.1/mingw47_32/include/QtCore -I./5.0.1/mingw47_32/include/QtGui -I./5.0.1/mingw47_32/include/QtWebKitWidgets -I./5.0.1/mingw47_32/include/QtWebKit -I./5.0.1/mingw47_32/include/QtWidgets -L./5.0.1/mingw47_32/bin -L./5.0.1/mingw47_32/lib -lQt5WebKitWidgetsd -lQt5Quickd -lQt5PrintSupportd -lQt5OpenGLd -lQt5WebKitd -lQt5Qmld -lQt5Widgetsd -lQt5Guid -lQt5Networkd -lQt5Cored  

Heres the output

here1
argc: 1
Unhandled page fault on read access to 0x0090b000 at address 0x6b9fe768 (thread 0009), starting debugger...

Heres the debugger details

Unhandled exception: page fault on read access to 0x0090b000 in 32-bit code (0x6b9fe768).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:6b9fe768 ESP:006bfba8 EBP:006bfba8 EFLAGS:00010202(  R- --  I   - - - )
 EAX:0090b000 EBX:00153528 ECX:021bf680 EDX:00000000
 ESI:00000052 EDI:001103b0
Stack dump:
0x006bfba8:  006bfc48 6b9470ac 0090b000 021bf680
0x006bfbb8:  79f4a2a0 7bc4b7b9 00000000 00000000
0x006bfbc8:  feedbab1 00000001 00000000 00000000
0x006bfbd8:  00000000 00000001 00000000 001395e4
0x006bfbe8:  006bfce8 649453ce 6b9f23cc 6bae0880
0x006bfbf8:  006bfc30 6b947171 006bfbb0 00153520
000c: sel=0067 base=00000000 limit=00000000 32-bit --x
Backtrace:
=>0 0x6b9fe768 qCopy<char**, char**>+0x8(begin=0x90b000, end=0x21bf680, dest=0x79f4a2a0) [Q:\qt5_workdir\w\s\qtbase\src\corelib/../../include/QtCore/../../src/corelib/tools/qalgorithms.h:81] in qt5cored (0x006bfba8)
  1 0x6b9470ac QCoreApplicationPrivate+0x173(this=0x153528, aargc=0x6bfd58, aargv=0x6bfd80, flags=0x1530d0) [Q:\qt5_workdir\w\s\qtbase\src\corelib/kernel/qcoreapplication.cpp:338] in qt5cored (0x006bfc48)
  2 0x08554553 QGuiApplicationPrivate+0x28(this=0x153528, argc=0x6bfd58, argv=0x6bfd80, flags=0x1530d0) [Q:\qt5_workdir\w\s\qtbase\src\gui/kernel/qguiapplication.cpp:418] in qt5guid (0x006bfc78)
  3 0x00915865 QApplicationPrivate+0x28(this=0x153528, argc=0x6bfd58, argv=0x6bfd80, flags=0x1530d0) [Q:\qt5_workdir\w\s\qtbase\src\widgets/kernel/qapplication.cpp:157] in qt5widgetsd (0x006bfca8)
  4 0x00916181 QApplication+0x32(this=0x390, argc=0x6bfd58, argv=0x6bfd80, _internal=0x1530d0) [Q:\qt5_workdir\w\s\qtbase\src\widgets/kernel/qapplication.cpp:537] in qt5widgetsd (0x006bfce8)
  5 0x0046fbe4 in testwin32 (+0x6fbe3) (0x006bfd78)

Share this post


Link to post
Share on other sites
Advertisement
I guess you're better off at a QT specialized forum...
But what is the value of argv? Is your environment restrictive (not admin or similar)? Edited by dejaime

Share this post


Link to post
Share on other sites

You must use qmake to parse Qt code, mostly due to the signals and slots stuff not being standard c++ until QMake turns it into standard c++ and spits out the moc files.

Share this post


Link to post
Share on other sites

@dejaime yea I have been asking around everywhere and finally figured out that it was that my compiler was version 4.6 and qt 5 on starts with 4/7 and moves to 4.8 so im now using qt version 5.2 which uses mingw version 4.8 and most of everything seems to be fixed having some troubles but making headway and getting it sorted out.

 

@EddieV223 um no you do know moc is its own command for the signals and has nothing to do with qmake if I call it or qmake calls it it does the same thing and secondly there are no slots or symbols in the small example I posted.

Share this post


Link to post
Share on other sites

You must use qmake to parse Qt code, mostly due to the signals and slots stuff not being standard c++ until QMake turns it into standard c++ and spits out the moc files.


That is untrue. qmake automatically runs the moc'er on the required files, but the same can be done by hand in make files or MSVC project files. Using CMake is another way to completely automatize it as well (see CMAKE_AUTOMOC). I have been working with Qt professionally for years and sometimes I dabbled a bit on the side with it. I never had to use qmake for anything (unless you count building Qt itself using it's own build system).

jeff8j: One annoying pitfall that is not very well documented are the plugins. Missing DLLs (like QtCore or QtGui) will result in proper startup errors but missing plugins (especially the window system plugin) can be annoying to get right at first. I don't have the details with me right now but if in doubt copying the whole plugins directory (with all the DLLs contained therein) next to the executable often helps.

Share this post


Link to post
Share on other sites

@BitMaster Exactly I cant use qmake for some of our projects and dont like when everyone says/thinks you have to. OMG where were you the other day those plugins have been driving me nuts I just figured out earlier today how to change their directory for distribution.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!