I
I
IOV2016-07-25 04:41:52
Qt
IOV, 2016-07-25 04:41:52

Incorrect compilation of Qt application in msvc2015?

The compilation proceeds normally, but the following error occurred while the program was running:
92e83e3ce63f45998ce9014d1357815b.pngThe name of the user's folder, if it is written in Cyrillic, is displayed in shorthand and the program does not find the user's folder.
Input data:
OS Windows 7
Qt 5.6
Compiler msvc2015 (32bit/64bit)

In the process of finding a solution to the problem, I found out that in addition to this error, QStandardPaths paths are also displayed with shorthands, as well as in "int main(int argc, char *argv[] )", if argv contains the path to an externally transmitted file and it is in the user's folder, then it is also displayed with shorthands.
After testing on a separate project, I found out that this problem does not arise when compiling in MinGW, however, the project uses webenginewidgets, so the MinGW compiler is not suitable. However, this shows that the problem is in the msvc2015 compiler, which I could not determine!
Tried:

  • Reinstall Qt
  • Reinstall Visual Studio

The result is the same.
Additional data/results:
  • Other applications written in Qt (not by me) work fine on my computer.
  • In the application itself, the Cyrillic alphabet is displayed correctly, there are no problems.
  • When compiling the release version, the same is true.
  • Later I found out that the folder with krakozyabry is created in the system (while the error remains), but if you delete it, then new errors appear already in the compiler :465f29655275470eafdfcbd9dfbbcc17.png
  • Googling a lot of Russian and English resources, I found only a couple of references to this problem and not a single solution. The maximum recommendation is to use MinGW, which does not suit me.

I suppose that perhaps there is no answer because the solution is too banal, but alas, I was not able to find out the reason on my own.
Perhaps MSVC has problems with UTF8 encoding? Then how to solve it ...
Thanks in advance to everyone who will suggest ways to solve my problem.
Additionally, the code of the program with the problem:
file test.pro
TEMPLATE = app

QT       += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11

TARGET = test

SOURCES += main.cpp

main.cpp file
#include <QApplication>
#include <QString>
#include <QMessageBox>
#include <QFileDialog>
#include <QStandardPaths>

using namespace std;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    /*первый тест проблемы*/
    QString file=QFileDialog::getOpenFileName(0,"Select file",QString(getenv("PROGRAMFILES")),"(*.exe)");

    /*второй тест проблемы*/
    QString addin_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
    QMessageBox msgBox;
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setWindowFlags(Qt::CustomizeWindowHint);
    msgBox.setWindowTitle("Information");
    msgBox.setText(addin_path);
    msgBox.exec();
    return a.exec();
}

Results of running this program:
first example of the problem
f814112e95e4480d96f6efefd535f934.pngsecond example of the problem
9ce91e5b6af7454d810e623357d31707.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rou1997, 2016-07-25
@Rou1997

Apart from MinGW, another version of MSVC can be used.

I
IOV, 2016-07-29
@auditor

Problem solved in a way. In fact, it never existed...
The fact is that if you do not start the program immediately from Qt, but after compilation run it yourself in the system, then the program works quite normally.
It turns out that there is an error, of course, but this is not a compiler error, but still a Qt error. And most importantly, it is quite possible to live with it, it is enough to change the username to English on the computer on which development is underway.
However, I would still like to understand the causes of the error. I'm still waiting for your suggestions!

K
Konstantin Stepanov, 2016-08-04
@koronabora

MSVC Qt plugin must be installed and paths must be set in it.
And also, if they build a 32-bit application in a 64-bit system, where 64-bit QT is the first in the Path, then windeployqt will copy 64-bit libraries to a 32-bit application. You have to fill it by hand for the first time.
There are no problems with 64 bit application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question