Answer the question
In order to leave comments, you need to log in
Incorrect compilation of Qt application in msvc2015?
The compilation proceeds normally, but the following error occurred while the program was running:
The 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:
TEMPLATE = app
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
TARGET = test
SOURCES += main.cpp
#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();
}
Answer the question
In order to leave comments, you need to log in
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!
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 questionAsk a Question
731 491 924 answers to any question