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!
In the end it was a mix of problems:
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.
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!