Error QApplication: no such file or directory

前端 未结 11 1817
挽巷
挽巷 2021-01-30 06:44

I have installed C++SDK that have Qt but when I try compiling a code linking QApplication it gives me the error:

Error QApplication: no such file or directory
         


        
11条回答
  •  走了就别回头了
    2021-01-30 07:15

    Well, It's a bit late for this but I've just started learning Qt and maybe this could help somebody out there:

    If you're using Qt Creator then when you've started creating the project you were asked to choose a kit to be used with your project, Let's say you chose Desktop Qt MinGW 64-bit. For Qt 5, If you opened the Qt folder of your installation, you'll find a folder with the version of Qt installed as its name inside it, here you can find the kits you can choose from.

    You can go to /PATH/FOR/Qt/mingw_64/include and here you'll find all the includes you can use in your program, just search for QApplication and you'll find it inside the folder QtWidgets, So you can use #include since the path starts from the include folder.

    The same goes for other headers if you're stuck with any and for other kits.

    Note: "all the includes you can use" doesn't mean these are the only ones you can use, If you include iostream for example then the compiler will include it from /PATH/FOR/Qt/Tools/mingw_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/iostream

提交回复
热议问题