Qt Application crashes whenever WebKit tries to load HTML - c++

I'm using Qt 4.7.4 with C++ and I'm trying to embed a html document with some flash elements into a Qt application. To start out I added a QWebView widget to my main window and tried to load a html document stored on my harddrive, that caused an error so I looked up the Qt examples and attempted to run the youtube viewer example here: http://qt-project.org/wiki/Embed_YouTube_Video_in_QWebView
Both times I got the same issue when attempting to run the program:
"The procedure entry point ??1QSslSocket##UAE#XY could not be located
in the dynamic link library QtWebkit4.dll"
I used dependency walker and it states that QSslSocket is in QNetwork4.dll which is in my release folder (and it's the release version). Also my QTDIR environment variable points to the correct location and the location of the bin folder is in my path variable.
So I was wondering if anyone here could help me out. I'm also using visual studio 2005 (unfortunately using Qt 4.7.4 and vs 2005 are out of my control in this instance)

You would need to check the following things:
Your Qt installation is built with SSL support.
You have the SSL dll correctly recognized.
You have the version required to avoid symbol mismatches.

Related

No SSL access from Qt C++ application run outside of QtCreator but access running inside it?

I am running Linux Mint 18.3 and QtCreator (Qt version 5.15 installed from Qt installer download from Qt site, not repository binaries for the distrubution) and developing a C++ GUI application. Because of the openSSL mismatch between native Mint SSL version and that used by Qt5.12 onwards, I have installed the OpenSSL1.1.1d binaries via the Qt Maintenance Tool and have explicitly added these libraries to my application project.
Without this step nothing works. With this step, my application runs successfully when initiated WITHIN QtCreator, but not when I just run the binaries outside of it.
I know that I must be missing something simple here, but what is QtCreator doing that enables access to SSL? I have tried creating simlinks to these libraries (libcrypto.so.1.1 and libssl.so.1.1) locally within the binary directory but this has no effect.
I would like to be able to run my application without having to do so inside of QtCreator but so far I can find no workaround to allow this. Can anyone suggest what I am missing?
I can confirm that the output of calls to my QSslSocket::sslLibraryVersionString() function are returning empty string and "OpenSSL 1.1.1d" respectively, so I am convinced this is a runtime linking problem.

Cannot run Qt Creator GUI outside of Qt. "The application was unable to start correctly (0xc000007b)" error

I downloaded C++ code from GitHub to tag images for training an object detector using Machine Learning.
Within Qt Creator 4.2.1 Based on Qt 5.8.0 (MSVC 2015, 32bit), I was able to compile and run the code. Unfortunately, I was not able to run the .exe outside of Qt Creator.
Initially, I received an error that
"The program can't start because libgcc_s_dw2-1.dll is missing".
Thanks to
QT The program can't start because libgcc_s_dw2-1.dll is missing, that was fixed easily by adding
"QMAKE_LFLAGS += -static"
to the .pro file. Now, when I run it I get
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
I was able to reproduce the error using the simple "Hello World" default project that appears when you create a Qt Widget Application. This led me to believe something was wrong with my installation.
Based on the advice of this article: https://stackoverflow.com/questions/12099117/32-bit-qt-application-on-win-7-x64-wont-run-but-runs-fine-from-qt-creator, I used Dependency Walker to identify possible causes. I expected to see only a few items that I can follow up on. Instead, I received a list of close to 100 missing .dll files. All the files started with
"API-MS-WIN ###.DLL" or "EXT-MS ###.DLL"
where ### represent some additional text characters, for example;
"API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL"
I'm attaching a sample output.
Another suggestion was to copy over
libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll.
That did not work either.
My next move was to simply get the latest version of QT and wish for the best. I installed Qt Creator 4.8.1 Based on At 5.12.0 (MSVC 2015, 32 bit). This time, I could not even get the code to run in the IDE. I received 1000+ error messages!
Based on advice from several pages, I added
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
to the .pro file and it still would not compile.
Also, I verified that the application is being built as a 32bit application. I'm running on a 64 bit Windows 10 system.
If anyone would like to take a crack at it to see if they can create a working .exe, here is the link: github.com/clavicule/BBTag
Qt provides a tool to copy the necessary dlls to the folder of your executable.
The tools is called windeployqt.exe and comes with your Qt installation. For me it is located at C:\Qt\5.9.1\msvc2015_64\bin\windeployqt.exe. You will have to look at your installation path and probably the msvc_32 folder to find it.
Then you go to the folder with your executable in it, oben a command prompt or powershell and execute path\to\windeployqt.exe yourProgram.exe and it will automatically copy the necessary dll files to this folder. Afterwards you can run your program without issues.
The official documentation for the tool can be found here.
Alternative 1: While developing you could use QtCreator which automatically adds the paths to the dlls when running your program - make sure to include them if you deploy your program!
Alternative 2: Add the path to the necessary dlls to your PATH variable. This isn't recommended either, since everyone who gets your program would have to do the same to run it.
I figured it out! My installation of Anaconda (a Python distribution popular for data science and machine learning) is the culprit.
From: #remy-lebeau
The application was unable to start correctly (0xc000007b)
The error:
"The application was unable to start correctly (0xc000007b) ..."
is a good indicator that the 32-bit app tried to load a 64-bit DLL. At first, this did not make sense since I verified many times that I was using the 32 bit version of Qt.
It turns out that the installation of the 64 bit version of Anaconda also contained many Qt5 dlls used for the PyQt5 package. Since the path to this folder came before the path to my c:\Qt...\bin folder, it was used in the build instead of the actual 32 bit version installed with Qt. This was not obvious because I was unaware of PyQt5 so I had no idea that it came with Anaconda. A simple reordering of the path entries using the System Environment Variables interface AND a system restart fixed the problem.
Silver lining: I now know C++ and designing GUIs w/ QT and PyQt5
Thanks #albertmand and #jwernerny

QStrings not showing when debugging with Qt Creator on Windows

I'm debugging a Qt 5.5 application with Qt Creator on Windows 10 using MSVC 2013 compiler.
CDB Debugger is set up in Qt Creator and I can start the debug session. However variable contents of Qt objects (QStrings...) can not be inspected, I just get the memory location, size etc.
I expect I'm missing for debugging helpers or the debugger extension mentioned here.
Any clues what to do?
I temporarily deleted qtcreatorcdbext.dll, started debugger (forcing to diplay an error) and moved the dll back. Now everything works.
It seems there was a problem with the setup procedure, maybe because debugging tools were installed after Qt Creator.
I had to update qtcreatorcdbext.dll in /lib/qtcreatorcdbext32 folder. My Qt creator installed separatly from the Qt pack so I copied the dll from the Qt installation/tools/qtcreator/lib/qtcreatorcdbext32 to the separatly installed qtcreator

WebBrowser component in Dev-C++

I want to use a WebBrowser control in a Dev-C++ project. Ages ago, when I was using VB6, I just added the WebBrowser control (C:\Windows\System32\shdocvw.dll) to my form and it worked, but I'm lost in C++.
Should I load it dynamically with LoadLibrary, then somehow add it to my dialog window? I want to have standard features like page navigation, dynamic HTML elements, submittable forms, view page source, etc.
Update:
I installed Qt Maker and downloaded a test project from the official site. But when running/compiling I get this error:
Could not find make command: make in the build environment
Error while building project betalabsclient (target: Desktop)
When executing build step 'Make'
Does anyone have any ideas? Mingw is installed, of course.
This is not the answer for your question, but you may want to try and use Qt and the webkit browser component in it.
There are several webkit-related samples and I assume that they may actually suit for your needs "as they are".
Web Browser Example (ActiveQt)
HOWTO: Get QT working with Dev-C++

QtWebEngine - procedure not found

I have a simple C++ (non Qt Quick) application (that does not use .pro mechanism) built against the official Qt 5.4.2 x64 build (with openGL support).
As soon as I use the QWebEngineView object in my application, it fails to load with a message "Specified procedure could not be found".
With the help of gflags, it seems it fails to find the following demangled procedure:
public: __cdecl QOpenGLWidget::QOpenGLWidget(class QWidget * __ptr64,class QFlags<enum Qt::WindowType>) __ptr64
I am not sure to understand why this cannot be found, I have put for the sake of testing all the dlls in Qt_DIR\bin next to the application, and all the plug-ins.
The preprocessor list I use to build my app are as follow:
WIN32;_DEBUG;_WINDOWS;_USRDLL;WIN64;QT_WEBENGINEWIDGETS_LIB;QT_WEBENGINE_LIB;QT_QUICK_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NETWORK_LIB;QT_UITOOLS_LIB;QT_CORE_LIB;WIN32PROJECT5_EXPORTS;PLUGIN_VENDOR_NAME="$(VendorName)";PLUGIN_VERSION="$(PluginVersion)";PLUGIN_NAME="$(PluginName)";%(PreprocessorDefinitions)
And the input libraries:
Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;Qt5WebKitd.lib;Qt5WebKitWidgetsd.lib;Qt5WebEngineWidgetsd.lib;Qt5WebEngined.lib;Qt5OpenGLExtensionsd.lib;Qt5OpenGLd.lib;Qt5Networkd.lib;Qt5Xmld.lib;D:\NotBackedUp\Tools\Qt\5.4\msvc2013_64_opengl\lib\qtmaind.lib;shell32.lib;Qt5Quickd.lib;Qt5PrintSupportd.lib;Qt5Qmld.lib;Qt5UiToolsd.lib;glu32.lib;opengl32.lib;gdi32.lib;user32.lib;o2d.lib;%(AdditionalDependencies)
I wanted to try a simple example in Qt Creator 3.6.1 but it complains: Project ERROR: Unknown module(s) in QT: webenginewidgets
The browser.exe example runs fine (built with visual studio)
Do you have any idea of what is wrong?
PS: I am on windows 8.1.
For the procedure not found, my dll is a plug-in of a Qt application that is not built with opengl support. Only my dll is built with opengl support.
When initializing the plug-in, the application uses its own dlls rather the mine... and therefore fails to have any opengl support for the web engine.
For Qt Creator, it selected automatically a wrong kit. I had to create a new kit which maps to the correct Qt binaries (with opengl support): follow this: http://doc.qt.io/qtcreator/creator-configuring-projects.html.
Hope it will help someone