I download qt in my computer and called QDir as#include<QDir> .
But it come up with error fatal error: QDir: No such file or directory . Is there anyway to use QDir without creating a .pro file?
I tried to create a .pro file:
Template += app
QT += core
Source += src.cpp
But it does not work
#include <QDir>
src.cpp:1:16: fatal error: QDir: No such file or directory
Minimal .pro file which builds your src.cpp,assuming you also have
mainfunction there:Please use Qt Creator new project wizard to create the .pro file (or CMake's cmakelist.txt) for you, or use a known-good example/template to start from, so you get everything right. You do not want to use a complex framework like Qt without a makefile generator! But if you really must, use qmake (or cmake) to generate the makefile once, then remove the .pro file and keep editing the makefile. Just note that it probably won't work for anybody except you without a lot of extra work. So just don't go there.
Complete working example which does something with QDir:
.pro file:
Example main.cpp: