Qt Creator Compiling Error at step 'make'

2019-02-14 13:26发布

问题:

I just started using Qt Creator for creating C++ GUI programs. I just downloaded it and installed it, but the compiling process is throwing me errors. When I try to compile my project (very simple, just a QLabel on the screen...it's my first project) it comes up with the error:

qtcreator_ctrlc_stub: Command line failed: C:\Users\andrew\Dropbox\Programming\C++\build-
FirstGUIApp-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile 10:04:35: The process "C:\Users\andrew\Dropbox\Programming\C++\build-FirstGUIApp-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile" exited with code -1. Error while building/deploying project FirstGUIApp (kit: Desktop Qt 5.1.1 MSVC2012 32bit) When executing step 'Make'

I hunted around for an answer here and here and a couple other places but I'm just confused about the whole thing. I have a couple of ideas of my own but I don't know how to try my ideas. Here are some of my ideas:

1) MinGW isn't in the path or isn't installed

But, if it isn't in the path, how do I put it in? Where is it? I have Code Blocks installed which has MinGW installed, so could I maybe use it from there?

2) the make file is messed up somehow

Again, what could be wrong and how could I fix it?

3) Qt Creator isn't installed correctly.

Obviously, re-install it, but I want to make sure all other options are tried before, because it took me a very long time to download.

I apologize if I'm sounding noobish or it's a stupid question, but I really am confused with all of this. Please be patient with me and try to explain things well and thoroughly. I'm using Windows 8.1 and downloaded the offline installer. Thanks in advance.

UPDATE


Here is a screenshot of my Qt, how can I tell if it is the visual studio or minGW version?

UPDATE


Here is my MinGW Folder in CodeBlocks. Is this the folder with the compiler or is it something else?

回答1:

For your ideas: 1: if you downloaded from qtproject with binary. then qt and qt creator should be installed under the C:\Qt\Qt5.1.1 then corresponding minGW should be stay in C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\gcc.exe this is the directory you need. Remember, QtCreator needs two tools to make sure your project and compile and run, qmake and compiler. Qmake is tool help you translate .pro file into makefile, compiler (gcc) minGW use gcc to run the makefile, compile your code to binary.


where to figure out tools you are using are correct? ---> qtcreator --> Tools -> Build&Run -> Kits in here You should be able find different kits, of course you maybe have only one.

Select one, Double check the Qt Version and Compiler is the one you wish to use. click Manage next to compiler, Every compiler in the Auto-detect should be ok to use. If you don't see anyone, add one, click Add, MinGW, put C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\gcc.exe like into path. ABI should auto-set depends on your environment.


Answer to your second question, what's wrong with your makefile, no one knows, you should check your .pro, usually makefile are generated by qmake xx.pro. Double check your .pro file and re-run qmake will solve the problem.



回答2:

  1. in tools->options->build&run check if minGW is actually there in the compiler and kit list

    in the project tab (on the left hand side) you can set the environment for the build click the PATH value and add the path to minGW to it (you may need to add a lib and include var so the standard library gets added)

  2. re run qmake from the build menu

  3. double check you have the correct version it looks like you have the visual studio Qt not the minGW version,



回答3:

Terminal:(in Linux) sudo apt-get install build-essential cmake libqt4-dev

i'm sorry i dont know why this code works,but i have the same problem in linux and this code worked.