Tag Archives: QT Error

[Solved] qt5.9 + vs2015 32bit Error: “-1: error: LNK1158: Can not Run “rc.exe”

The development platform qt5.9.0+vs2015 32bit…. After preparing to run vs2015 and installing vs2019, an error occurred when running the original program that could run

“-1: error: LNK1158: cannot run “rc.exe”

Copied the two files “rc.exe rcdll.dll” in the “C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86” directory to “C:\Program Files (x86) \Microsoft Visual Studio 12.0\VC\bin”. 

(Pay attention to the version number, because I am 32-bit so I choose X86, the reason why I choose “Microsoft Visual Studio 12.0” instead of “Microsoft Visual Studio 14.0” is that it should be in my “C:\Program Files (x86)” directory The best is “Microsoft Visual Studio 12.0”). 

Add the path C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86 to the system environment variable Path, as shown in the following figure:

 After following the above steps, the problem is solved.

[Solved] Qt Error: undefined reference to xxxxx

Error reporting information:

first of all, it is necessary to distinguish the two types of error : undefined reference to xxxxx and "XXXX was not declared in this scope". The former is because the compiler can find the declaration of the function, but cannot find the definition of the function, so it reports an error; The latter is not found at all. You should first check whether the header file is missing.

For undefined reference to xxxxx, there are two situations at present

1. The path to ffmpeg in the pro file is not correct
2. The header file is written in C, but without extern "C" {}

 

[Solved] Qt Error: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed

Project scenario:

QT network programming appears when requesting the website: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed


Problem description

Cause analysis:

The computer may not have the correct OpenSSL installed.


Solution:

1. we use the following code to determine the OpenSSL version our QT support

#include <QSslSocket>
#include <QDebug>
qDebug()<< QSslSocket::sslLibraryBuildVersionString();

My output here is:
you can see that my OpenSSL version is bit 1.1.1. Download the corresponding version of OpenSSL
2. on this website: http://slproweb.com/products/Win32OpenSSL.html Download the corresponding OpenSSL version. One thing to note is: if you use MinGW 32-bit kit, Download

otherwise, if you use MinGW 64 bit kit, Download win64 OpenSSL. Note that both compilers only need to download the EXE executable of the light version.

3. Install OpenSSL
click next all the time. In the last step, set the folder to bin.
4. Copy the file
I downloaded the Win64 version of OpenSSL here. Therefore, copy the libcrypto-1_1-x64.dll and libssl-1_1-x64.dll files in the OpenSSL folder to the qt installation directory. The specific directory is here: D:\Qt\Qt5.14.0\5.14.0\ mingw73_64\bin. If you download 32-bit, you only need to put it in the D:\Qt\Qt5.14.0\5.14.0\mingw73_32\bin directory, and the others are similar.
5. Ends
if you run the project file again, QT will not report the error: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed

[Solved] QT Error: error: undefined reference to `GameModel::~GameModel()’

When compiling Qt program, error: undefined reference to `GameModel::~GameModel()’ is reported.
This is because Qt does not automatically generate the class destructor, so we need to write it ourselves, even if it is an empty function. After we write GameModel::~GameModel() by hand, the problem disappears when we compile it again.

There are two ways to write destructors:
Method 1:
in .cpp file:

Method 2:
in .h file.
in Destructor of

QT Error: use of undeclared identifier [How to Solve]

When doing some SDK development, we will copy the example code to our own code for testing

In this process, some methods or variables will be copied

The following figure often appears

The system prompts use of unclared identifier ‘a variable’

Generally, this variable may not be defined in the. H file. If you check the header file and find that it is also defined.

However, if this problem still occurs, you need to check and add the class name in front of the method name that reports an error

After the class name is included, no error will be reported

Qt error: no matching function for call to ‘MainWindow::connect(QAction*&, void (QAction::*)

Error in QT compilation:

error: no matching function for call to 'MainWindow::connect(QAction*&, void (QAction::*)(bool), MainWindow* const, MainWindow::MainWindow(QWidget*)::__lambda0)'});

Error reason: QT software version is too low, lower than qt5.4.

Solution: add code to. Pro file:

CONFIG   += C++11

Problem solving.