Results 1 to 8 of 8

Thread: Quick question about adding mingw as compiler

  1. #1
    Join Date
    Oct 2012
    Posts
    8
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Quick question about adding mingw as compiler

    Hey

    When i downloaded the qt sdk it installed the msvc2010 compiler and debugger,
    And i want to have the mingw as compiler instead.

    I have read that i can download the mingw to qt but in the package manager it shows that mingw alredy is installed. I have a compiler with mingw to but not for desktop. It is for the simulator option.

    So my question is: how can i add mingw to the desktop compiler & build option?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Quick question about adding mingw as compiler

    When i downloaded the qt sdk it installed the msvc2010 compiler and debugger,
    No it didn't. It may have installed Qt libraries built using that compiler but Microsoft would take dim view of third parties distributing their compiler.
    And i want to have the mingw as compiler instead.
    The SDK installer does/can install this tool chain for the Windows target. If it has not then you can use the SDK maintenance tool to do it. You should to install a set of Qt libraries built with MingW at the same time if they were not installed by default.
    I have read that i can download the mingw to qt but in the package manager it shows that mingw alredy is installed.
    Hmmm, so what is the problem again? Open the Start Menu, find Qt SDK (or something like that) and start the command prompt. Type gcc -v to verify.

  3. #3
    Join Date
    Oct 2012
    Posts
    8
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default New and the last problem!

    now i feel me dump, but i have to say i was to tierd last night now today i saw the mingw option in the updater i dident saw it yester day


    Added after 1 51 minutes:


    now all is working, but i still have one problem. and i dont really know what that is for kind of problem.

    Now when i can use the open cv headers and libaries, I tried to test a hello world app,
    and when i paste the code i dont get anything, it just says like this.

    Starting C:\c++\Opencv_test_mingw\release\Opencv_test_mingw .exe...
    The program has unexpectedly finished.
    C:\c++\Opencv_test_mingw\release\Opencv_test_mingw .exe exited with code -1073741511

    here is the compiler output:

    Qt Code:
    1. 13:30:00: Running build steps for project Opencv_test_mingw...
    2. 13:30:00: Configuration unchanged, skipping qmake step.
    3. 13:30:00: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
    4. C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Release
    5. mingw32-make.exe[1]: Entering directory `C:/c++/Opencv_test_mingw'
    6. mingw32-make.exe[1]: Nothing to be done for `first'.
    7. mingw32-make.exe[1]: Leaving directory `C:/c++/Opencv_test_mingw'
    8. 13:30:00: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited normally.
    To copy to clipboard, switch view to plain text mode 

    my .pro file:

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2012-10-24T13:25:06
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. TARGET = Opencv_test_mingw
    10. TEMPLATE = app
    11.  
    12.  
    13. SOURCES += main.cpp\
    14.  
    15.  
    16.  
    17. INCLUDEPATH += "C:/OpenCV2.4MinGw/install/include"
    18. LIBS += "C:/OpenCV2.4MinGw/bin/*.dll"
    19.  
    20. HEADERS +=
    21.  
    22. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 

    My main file:

    Qt Code:
    1. #include <opencv/cv.h>
    2. #include <opencv/highgui.h>
    3.  
    4. int main ( int argc, char **argv )
    5. {
    6. cvNamedWindow( "My Window", 1 );
    7. IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 );
    8. CvFont font;
    9. double hScale = 1.0;
    10. double vScale = 1.0;
    11. int lineWidth = 1;
    12. cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC,
    13. hScale, vScale, 0, lineWidth );
    14. cvPutText( img, "Hello World!", cvPoint( 200, 400 ), &font,
    15. cvScalar( 255, 255, 0 ) );
    16. cvShowImage( "My Window", img );
    17. cvWaitKey();
    18. return 0;
    19. }
    To copy to clipboard, switch view to plain text mode 

    it sould make a window, but it isent doing that, what is the error?
    when i debug and build i got this message (look on attachmented image)

    have tryed a few other apps from the "http://qt-apps.org/"
    with the same error.
    Attached Images Attached Images
    Last edited by melzk; 24th October 2012 at 13:07.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: New and the last problem!

    exited with code -1073741511
    This 32-bit number is 0xC0000139 in hex. It means "DLL entry point not found" or something similar although finding that in Microsoft docs is not something I have done. Generally it means you are missing or have the wrong version of a DLL.

    Load your program exe in Dependency Walker to see what it thinks in missing.

    When you run your compiled program Windows needs to be able to find the libraries it depends on. Qt Creator ensure this for the Qt libraries, but external libraries you need to cater for yourself. The OpenCV libraries are probably not available in the run time environment. Either add the OpenCV bin directory (contains the OpenCV DLL files) to the system PATH or use Qt Creator's run configuration to set the extra PATH element only for Creator-launched programs.
    Last edited by ChrisW67; 24th October 2012 at 23:02.

  5. #5
    Join Date
    Oct 2012
    Posts
    8
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: New and the last problem!

    hello again chris

    i was so angry about this so, i reformatted my computer, so now i have a nice and clean verson of windows, qt sdk, mingw, cmake and the OpenCV libs
    When i tried to rebuild it so i get the same damn error.

    i used the Dependency walker and get this result:

    Error: At least one required implicit or forwarded dependency was not found.
    Warning: At least one delay-load dependency module was not found.
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
    The dll's that is missing is:

    QTCORE4.dll
    QTGUI4.dll
    QTTest4.dll
    GPSVC.dll
    IESHIMS.dll

    I have also added the open cv lib / dll's to the system path variable. here is my path:
    Qt Code:
    1. C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake 2.8\bin;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\MinGW\bin;C:\OpenCVB\bin;C:\OpenCVB\lib;
    To copy to clipboard, switch view to plain text mode 

    so what do you tink i should do next? i am so confused so i dont know what i should do? i also did a restart of evry time i changed the system variable.

    EDIT +6 h:

    Now som god news, I got the program to start. so what i have done:

    copied all off the "qt sdk/desktop/x.x.x/mingw/bin" dll's to the appfolder. than it worked to make a exutable file. so i added the path to the exutable folder in the system path.

    the problem now is that the program "The program has unexpectedly finished.
    C:\Programering\test\release\test.exe exited with code -1073741511" so it wont be closed in the task manager.
    but it starts, so i will try to look where the debugger dll's are and try to add them in the path to

    EDIT: +6 h 10 min

    i found them and they are in the same folder as the exutable dll's so why isent it working the. the files are in the system path variable.
    i think i am totaly lost on this now.
    Last edited by melzk; 25th October 2012 at 21:56.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: New and the last problem!

    i was so angry about this so, i reformatted my computer, so now i have a nice and clean verson of windows, qt sdk, mingw, cmake and the OpenCV libs
    When i tried to rebuild it so i get the same damn error.
    I find it more productive to work the actual problem rather than just try stuff and hope it works. Getting angry... take a walk, clear your head, come back refreshed.

    http://www.qtcentre.org/threads/4692...945#post211945
    http://www.qtcentre.org/threads/5136...734#post230734
    To which I would add, your OpenCV libraries must also be reachable at run time by the program.

    The crash you are experiencing is of the same type. Dependency Walker will show library dependencies that are required to start the program when you load it. The program can dynamically load libraries after that and DW can only see these if you use the profiling feature and run your program under DW control.

    Are you still running just the test application from post #3?

    BTW: What is the point of QTestLib in a release application?

  7. #7
    Join Date
    Oct 2012
    Posts
    8
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Quick question about adding mingw as compiler

    I am trying to take it easy and think clear.
    I tought i was near to fix it yesterday. But becase i read and test all kind of
    Things and it not working. I have to try all kinde of other things.


    The strange thing about this is that, if i make a new project without opencv
    There are no errors. But when i runned the dependency walker it shows that
    It is the standart qt fils that is missing.

    The opencv files are working and can be found. So it is like qt just dont care about the orginal libs both for debugging and building the app.

    Today i will test open cv with a standard c++ ide, so i se that it isent the opencv that is tricking me.
    If it works. It must be some kinde of bug or something in the qt software.

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Quick question about adding mingw as compiler

    When you run your built program from inside an IDE the IDE typically ensures that the standard Qt libraries are in the PATH (LD_LIBRARY_PATH on Linux) the running program sees. When you load the program into DW the program is given the PATH that DW sees, usually the default Windows PATH, which does not include the Qt libraries... hence they are not found.

    Are you trying to get the program to run in Qt Creator or standalone? First one first.

    In Qt Creator:
    • Load your project
    • Select Projects from left toolbar.
    • Select Run from the options at the top of the page
    • Select your Run Configuration if you have more than one
    • Under Run Environment inspect the PATH variable.
    • You can adjust the environment to include the OpenCV bin directory and you should be done.

Similar Threads

  1. msvc Compiler or mingw compiler
    By Ashutosh2k1 in forum Qt Programming
    Replies: 3
    Last Post: 14th February 2011, 08:33
  2. How do I use MinGW Compiler in Windows
    By Walsi in forum General Discussion
    Replies: 3
    Last Post: 11th May 2007, 08:50
  3. MinGW Compiler under WXP
    By Walsi in forum Newbie
    Replies: 2
    Last Post: 30th March 2007, 17:26
  4. Where do I can download mingw compiler?
    By Illuminnator in forum General Discussion
    Replies: 3
    Last Post: 25th February 2007, 06:55
  5. Loaded QT 4.1.1 and MinGW Compiler
    By Seth in forum Newbie
    Replies: 7
    Last Post: 8th July 2006, 15:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.