Qt - Error 2 at compile time

前端 未结 5 2030
时光取名叫无心
时光取名叫无心 2020-12-11 16:59

I just downloaded Qt SDK 4.8.1 and, after installing it, I simply tried to compile a default C++ project, but I got this strange error.

16:50:24: Runn

相关标签:
5条回答
  • 2020-12-11 17:22

    Okay so you can do this.

    Go to Start->Choose Qt folder->minigw

    When you start it you will be loaded int cmd, after that locate your project. Then you can type: qmake and after that make and then you have built project

    If it doesn't work try to go trough the DOCUMENTATION to see how to use minigw when you are using Qt.

    If you need anymore help let me know I'll be glad to help you.

    EDIT:

    One more thing. In your question problem may be connected to environmental variables. As they are not probably set to show to the make command. If you don't want to bother with minigw you can maybe check your environmental variables if they have set path: to make

    0 讨论(0)
  • 2020-12-11 17:25

    In Linux terminal:

    sudo apt-get install build-essential cmake libqt4-dev
    

    I'm sorry I don't know why this code works but I had the same problem in Linux and I solved it this way.

    0 讨论(0)
  • 2020-12-11 17:35

    I've solved it : try to execute cl.exe directly (C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl) if you get a dll error, it's because your environment is not set correctly. So, you need to call vcvarsall.bat before lunch QtCreator. To do that each time, you can create a .bat file which contains the following:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat

    {Path to QtCreator}\qtcreator

    (Correct the paths if your configuration is not the same)

    You will need to execute this script to get QtCreator with the right environment variables, otherwise, the dll error appears but is not reported, and you get this "Error : 2"

    0 讨论(0)
  • 2020-12-11 17:39

    I create a new project with the same name in other folder, copy internal files except <project_name>.pro.user file.

    This work form me, I don't know why, but removing <project_name>.pro.user file from my original project error continues.

    0 讨论(0)
  • 2020-12-11 17:47

    I had somewhat similar problem in Qt 5.3

    21:22:03: Running steps for project Server...
    21:22:03: Configuration unchanged, skipping qmake step.
    21:22:03: Starting: "C:\Qt\Qt5.3.2\Tools\mingw482_32\bin\mingw32-make.exe" 
    C:\make\bin; -f Makefile.Debug
    Makefile:34: recipe for target 'debug' failed
    process_begin: CreateProcess(NULL, C:\make\bin; -f Makefile.Debug, ...) failed.
    make (e=2): The system cannot find the file specified.
    
    mingw32-make: *** [debug] Error 2
    21:22:05: The process "C:\Qt\Qt5.3.2\Tools\mingw482_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project Server (kit: Desktop Qt 5.3 MinGW 32bit)
    When executing step "Make"
    

    I did the following to get rid of the error.
    From the left pane of the Qt,

    Projects > Build > Build Environment:
    
    Check the Clear System environment
    
    0 讨论(0)
提交回复
热议问题