Can't use open source on VS Code
-
Hi, thanks for reading me.
I'm trying to use the open source version of Qt on VS Code for a C++ program, but when i try to import the libraries it warning about the libraries can't been found.
When I revised the Path, i noticed than the "C:\Qt\bin", does'nt exist, but another paths like "C:\Qt\5.15.2\bin" neither exist, and "C:\Qt\5.15.2\msvc2019_64\bin" does'nt work.Can somebody tell me how can i use the libraries for make a GUI with Qt open source from VS Code?
Thanks.
-
C Christian Ehrlicher moved this topic from General and Desktop on
-
@Inderlard said in Can't use open source on VS Code:
"C:\Qt\5.15.2\msvc2019_64\bin" does'nt work
What exactly does not work?
Do you use CMake or QMake? -
@jsulm Sorry, maybe i had to add more documentation about the problem:
I new in Qt, and i'm trying to run this program on VSCode:#include <iostream> #include <QtWidgets/QtWidgets.h> #include <QtWidgets/QApplication> #include <QtWidgets/QLabel> #include <QtWidgets/QPushButton> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget window; window.setWindowTitle("Hello World!"); QVBoxLayout layout; layout.addWidget(new QLabel("Hello World!")); layout.addWidget(new QPushButton("Click Me!")); window.setLayout(&layout); window.show(); return app.exec(); }
Is a program made with blackbox in VS to learn, i don't know if it is right.
VSCode give me this error:fatal error: QtWidgets/QtWidgets.h: No such file or directory
And the same with the other libraries. I put in the environment variables the path i found on internet for similar problems, but it doesn't work cause i keep having the error.
I use this path cause the paths that i should put initially does not exist ("C:\Qt\bin", "C:\Qt\5.15.2\bin")
-
Hi,
You really should use a project management system such as CMake especially when you want to build a project with a framework such as Qt.
VS Code has cmake integration which should make your life way easier.
-
@Inderlard said in Can't use open source on VS Code:
"C:\Qt\5.15.2\msvc2019_64\bin" does'nt work.
The bin directory is the folder where things like qmake and moc reside. The includes are in C:\Qt\5.15.2\msvc2019_64\include. That is only half of the story. Both qmake projects as well as cmake projects have the ability to add Qt modules. These will correctly add the subfolders which contain the actual headers. You can add the include paths (e.g. C:\QT\5.15.2\msvc2019_64\include\QtCore) by hand, but you certainly should not. Use a CMake-based project to handle all the Qt dependencies and VS Code can work with that.