Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved]Difficulties getting QT5.0.1 to work (Windows 7 32bit)
I’m new to using QT5.0.1 and I am having some problems getting the program to work properly.
I’ve searched all over the internet but I can’t seem to find a clear documentation about the setup.
The installation wasn’t an issue at all, however I am not able to find out which paths I have to set in the environment variables or how the libraries are installed. The problem is, any example code I try to build/run gives me the same error:
The program has unexpectedly finished.
D:\QTProjects\SGP-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug\debug\SGP.exe exited with code -1073741511
Could anyone please point me in the right direction, the program seems very good and appealing to me. However I’m starting to get frustrated because of this issue.
That should be from a DLL that can't be found.
I'd run the executable from the command-line, where the error messages are usually more descriptive, i.e., you get the name of the DLL that can't be found (there may be several). Then, in your IDE, add that DLL's folder to the run environment's PATH, or you can just copy the DLL to the executable's folder.
Thank you for your response
I've tried to run it in cmd several times and I've added several dll's to the executable's folder, however now I get the message:
Cannot find the accesspoint of procedure_gxx_personality_sj0 in DLL-file libstdc++-6.dll
(roughly translated from dutch, so the error might be different in English)
That should caused by an incompatibility between compiler/library versions, i.e., you have libraries that were compiled with a different compiler (or compiler version) than the one you're using.
What's your IDE and compiler?
My IDE is QT5.0.1 based on QTcreator 2.6.2 and I'm using Mingw 4.7
OK. Your IDE is QT Creator. Here's a few things I'd try:
Locate libstdc++-6.dll on your system. On Windows 7, I'd use "where libstdc++-6.dll" on the command prompt, and let Windows search the PATH. Just to be sure, I'd run a "where gcc" as well. Then, if that got me no duplicates, I'd run a search using Windows Explorer.
Create a simple "Hello, World" C++ program and build it by calling g++ on the command line. Run it. If it runs with no errors, check it with Dependency Walker/Process Explorer to see where it's getting libstdc++-6.dll.
After making sure you have the location of a libstdc++-6.dll that works for your simple example, go into QT Creator and rebuild your Qt app. See the "Compile Output" pane. In my case, I see something like this:
C:/Dev/MinGWGet/bin/mingw32-make -f Makefile.Debug clean
Check mingw32-make's path on the "Compile Output" pane against the path of your working libstdc++-6.dll. If everything was working fine, they should be equal.
- Check you Build Environment's PATH on Qt Creator, to make sure your working libstdc++-6.dll's location is on the path. You can do the same for your Run Environment's PATH, but that shouldn't be a problem at this point, since you're running it from the command line.
I've tried your steps and found a working libstdc++-6.dll however that is from a earlier installed mingw, however when I copy that one to my QT folder it doesn't work anymore and sends the same error as before. The earlier installed mingw is also version 4.7, might there be a way to link that mingw to QT instead of the one that came along with QT?
[quote author="Arondix" date="1362495493"]
I’ve tried your steps and found a working libstdc++-6.dll however that is from a earlier installed mingw, however when I copy that one to my QT folder it doesn’t work anymore and sends the same error as before.
Yes, because there's a binary incompatibility between both libstdc++. You can't use that libstdc++, which is part of your earlier installed mingw, because you're building your Qt app with Qt Creator's mingw.
[quote author="Arondix" date="1362495493"]The earlier installed mingw is also version 4.7, might there be a way to link that mingw to QT instead of the one that came along with QT?
No, in this case you can't use an app built with one version and a lib built with the other version.
At this point, you have two options:
- If you don't need your earlier installed mingw, just use the mingw that came with Qt (this is, by far, the simpler option).
- If you absolutely need to work with your earlier installed mingw, then build Qt with it (I'd advise you to do it sans webkit, if possible).
If you choose to use Qt's mingw, you must determine where it has its libstdc++ (I'd suggest you look into <Qt's home dir>/Qt5.0.1/Tools/MinGW/bin) and add it to your PATH. You should also remove your earlier installed mingw from the PATH.
OTOH, If you need to use your earlier installed mingw, you'll have more work, namely:
- Build Qt with your earlier installed mingw.
- Check if Qt Creator has detected your earlier installed mingw. If it hasn't, you must add it (Options -> Build & Run -> Compilers).
- Add the Qt built with your earlier installed mingw to Qt Creator (Options -> Build & Run -> Qt Versions).
- I recommend creating a Kit (Options -> Build & Run -> Kits) for your early installed mingw and its version of Qt.
- On each project you create, check the PATH and QTDIR variables on the Build Environment and Run Environment, to make sure they're pointing to "your" versions of QT/mingw.
By going this route, you'll end up with two mingws and two versions of Qt on your system. There's nothing wrong with that (I have that on my system), but you must keep attention to your PATHs.
Alright I used the first option and now it seems to work,
Thank you for your time and patience :-D
You're quite welcome, glad I could help :D