Unknown type name: QProcess
-
wrote on 2 Apr 2025, 22:01 last edited by
Using clangd on a mac, the following code gives me an error: Unknown type name: QProcess.
Clangd presents no error for the #include <QProcess>, and the QProcess files are in the Qt Core folder.
I have tried:
a. Upgrading/downgrading Xcode
b. Qt 6.7.0, Qt 6.8.0, Qt6.9.0
c. Compiling without clangd.
The compile always fails with this error.#include <QObject> #include <QProcess> class ProcessTest : public QObject { Q_OBJECT public: explicit ProcessTest(QObject *parent = nullptr); private: QProcess test; };
I have included in my CMakeLists.txt
find_package(Qt6 REQUIRED COMPONENTS Quick Core) target_link_libraries(appTest PRIVATE Qt6::Quick Qt6::Core )
All the examples of using QProcess seem the same, so I have run out of ideas. Any suggestions?
-
Using clangd on a mac, the following code gives me an error: Unknown type name: QProcess.
Clangd presents no error for the #include <QProcess>, and the QProcess files are in the Qt Core folder.
I have tried:
a. Upgrading/downgrading Xcode
b. Qt 6.7.0, Qt 6.8.0, Qt6.9.0
c. Compiling without clangd.
The compile always fails with this error.#include <QObject> #include <QProcess> class ProcessTest : public QObject { Q_OBJECT public: explicit ProcessTest(QObject *parent = nullptr); private: QProcess test; };
I have included in my CMakeLists.txt
find_package(Qt6 REQUIRED COMPONENTS Quick Core) target_link_libraries(appTest PRIVATE Qt6::Quick Qt6::Core )
All the examples of using QProcess seem the same, so I have run out of ideas. Any suggestions?
@IanB So, your application is building and running fine, but QtCreator shows that error? This is the code model, which simetimes produces false positives.
-
-
Using clangd on a mac, the following code gives me an error: Unknown type name: QProcess.
Clangd presents no error for the #include <QProcess>, and the QProcess files are in the Qt Core folder.
I have tried:
a. Upgrading/downgrading Xcode
b. Qt 6.7.0, Qt 6.8.0, Qt6.9.0
c. Compiling without clangd.
The compile always fails with this error.#include <QObject> #include <QProcess> class ProcessTest : public QObject { Q_OBJECT public: explicit ProcessTest(QObject *parent = nullptr); private: QProcess test; };
I have included in my CMakeLists.txt
find_package(Qt6 REQUIRED COMPONENTS Quick Core) target_link_libraries(appTest PRIVATE Qt6::Quick Qt6::Core )
All the examples of using QProcess seem the same, so I have run out of ideas. Any suggestions?
wrote on 3 Apr 2025, 07:22 last edited by@IanB said in Unknown type name: QProcess:
The compile always fails with this error.
@jsulm is asking/guessing whether this is a compiler error or just an error shown to you in the editor but not when you actually compile? Please answer clearly.
-
wrote on 4 Apr 2025, 08:18 last edited by
You can get CMake to be verbose with the build process by going to Project Mode > Build Steps > CMake arguments and add
--verbose
.Then you can see the commands it tries to build.
Building with Qt 6.7, 6.8 or 6.9 on macOS with Xcode is something that works just fine.
I can think of only having to "activate" the Command Line Tools for Xcode. Please do try to:
- Open Xcode
- Go to Preferences
Cmd + ,
- Go to Location
- At the Command Line Tools: combobox select something there. I have Xcode 16.2 (16C5032a).
4/4