QT Error: Failed to create vertex shader [Three Methods to Fix]

As in the question, qt6 runs the quick program. If this error occurs, you only need to set the value of the environment variable QT_QUICK_BACKEND to “software”.
there are three methods:

Solution:

Method 1: add this environment variable to the system environment variable, as shown in the figure below

This method is applicable to the global
right-click this computer icon -> Attribute -> Advanced system settings -> Environment variable – > New

after setting, you need to restart the IDE and rebuild the project
note: this method is not recommended, otherwise running the program on a computer without setting this environment variable may fail

Method 2: by setting environment variables in QT program

This method is applicable to a single program
set the environment variables applicable to this program in the main function

qputenv("QT_QUICK_BACKEND","software");

Method 3: directly set the scenegraphbacken

This method applies to a single program

#include <QQuickWindow>
QQuickWindow::setSceneGraphBackend("software");

Read More: