0

So I have been trying to develop a Qt application and run it on another Windows 8.1 machine which doesn't have Qt installed. On my first computer, I used Visual Studio 2013 to develop my application and compiled it in release mode with the Multi-threaded DLL flag.

This produces a .exe file. In the same folder, I have:

accessible/                platform/
assimp.dll                 kernel32.dll                   
icudt52.dll                icuin.dll
icuuc52.dll                opengl32.dll                  
libEGL.dll                 libGLESv2.dll
Qt5Core.dll                Qt5Gui.dll
Qt5OpenGL.dll              Qt5Widgets.dll
msvcp110.dll               msvcr110.dll
msvcp120.dll               msvcr120.dll

I copied the Qt DLLs from C:/Qt32bits/5.3/msvc2013_opengl/. Except for libEGL.dll and libGLESv2.dll that I got from QtCreator as I couldn't find them in the previous folder. However, this shouldn't be a problem as I am compiling with msvc (not mingw), right?

In my code, at the very beginning I have:

QApplication app(argc, argv);
QGLFormat format;
format.setProfile(QGLFormat::CoreProfile);
format.setVersion(4, 0);
QGLFormat::setDefaultFormat(format);

/*And then later*/

cout <<  "Creating Window" << endl;
GLWidget *widget = new GLWidget(i); //i is the id of the widget
cout << "Widget created" << endl;
widget->makeCurrent();
cout << "Context current" << endl;

GLWidget derives from QGLWidget and in the constructor, I just set its ID attribute to i.

On my machine, everything works fine. But when I run my executable file on the second machine, I get the output:

"Creating Window"
"Failed to make context current."
"Widget created"
"Context current"

And then it crashes (MyApp.exe has stopped working)... What is weird is that "Failed to make context current" (which I believe was produced by makeCurrent()) comes before "Widget created"... Any idea of what's wrong and how I could debug this?

Thank you very much for your time and help!

Cœur
  • 37,241
  • 25
  • 195
  • 267
Gpack
  • 1,878
  • 3
  • 18
  • 45
  • Do you run the executable on your own machine in release mode outside of qtcreator? – Sebastian Lange Dec 01 '14 at 08:29
  • Yes, actually I don't use QtCreator at all, only Visual Studio 2013. I have tried to change the name of the Qt folder to do as if Qt was not installed on my machine and it works in release mode (I just double click the exe) – Gpack Dec 01 '14 at 08:44
  • So you are running the app outside of vs13 then and not starting it through IDE? You can check with depency-walker what dll the executable will be using. – Sebastian Lange Dec 01 '14 at 08:45
  • Maybe it is a matter of OpenGL configuration? For example 3D acceleration options? – vahancho Dec 01 '14 at 09:08
  • Yes I'm running the app outside vs13 and not through the IDE. I had used dependency walker but I also read somewhere that not all the issues are actually problematic. I'm gonna try again. Thanks – Gpack Dec 01 '14 at 09:11
  • @Vahancho: It must be something like that. Because I have tried on a third computer and it works! :) Thanks for your help! Now I'm just gonna try to figure out what's wrong with the second one... – Gpack Dec 01 '14 at 10:06

1 Answers1

0

In the end it was a mix of problems:

  1. The opengl32.dll that I was using seemed to be for 64 bits according to dependency walker (What's weird is that I took it from C:/System32/). I downloaded a new one for 32 bits and it worked fine. Thank you Sebastian Lange.

  2. The second problem probably comes from the second machine's graphic card/OpenGL. I've tried on a third computer and now it works fine. Thank you vahancho.

Hope this can help future coders!

Gpack
  • 1,878
  • 3
  • 18
  • 45