Qt Creator Error

2019-02-24 07:29发布

Launching debugging for a project and then,

Running build steps for project Text_Editor...
Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Qt/2010.05/Text_Editor/Text_Editor.pro -r -spec win32-g++
The process "c:/qt/2010.05/qt/bin/qmake.exe" exited normally.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/2010.05/Text_Editor-build-desktop'

C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

mingw32-make[1]: Entering directory `C:/Qt/2010.05/Text_Editor-build-desktop'

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\qt\include\QtCore" -I"..\qt\include\QtGui" -I"..\qt\include" -I"..\qt\include\ActiveQt" -I"debug" -I"..\Text_Editor" -I"." -I"..\qt\mkspecs\win32-g++" -o debug\main.o ..\Text_Editor\main.cpp

mingw32-make[1]: Leaving directory `C:/Qt/2010.05/Text_Editor-build-desktop'

mingw32-make: Leaving directory `C:/Qt/2010.05/Text_Editor-build-desktop'

g++: ..\Text_Editor\main.cpp: No such file or directory

g++: no input files

mingw32-make[1]: *** [debug/main.o] Error 1

mingw32-make: *** [debug] Error 2

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project Text_Editor (target: Desktop)
When executing build step 'Make'

I have no clue on that. I just installed it, created a new project and got that error instantly.

标签: qt qt-creator
5条回答
太酷不给撩
2楼-- · 2019-02-24 07:42

Try to change your build directory from C:/Qt/2010.05/Text_Editor-build-desktop to C:/Qt/2010.05/Text_Editor.

To do this just open your project in Qt creator, left click on Project on the left pane, then open build settings tab and edit Build directory input field.

查看更多
地球回转人心会变
3楼-- · 2019-02-24 07:46

Run Qt Creator with "Run as Administrator".

Problem Solved for [debug/main.o] error5

- Vivin NL

查看更多
迷人小祖宗
4楼-- · 2019-02-24 07:52

I had pretty much the same problem just now. Without getting into "why" - I unticked "Shadow build" from project options and my build was succesful. Funny part is - "Shadow build" worked yesterday, and nothing really changed that much in between.

查看更多
Explosion°爆炸
5楼-- · 2019-02-24 07:54

For reason or another it is not able to find your main.cpp (g++: ..\Text_Editor\main.cpp: No such file or directory). Basically that path should be ok if you have shadow build toggled on.

Location where the main.cpp is tried to find is:

C:/Qt/2010.05/Text_Editor/main.cpp

Double check that this is proper location (notice also case sensitivity to be sure)

you can try toggling off the shadow build from project -> check off shadow build. And also you should check that Text_Editor.pro contains properly the main.cpp.

Edit: It might be also wise to create that project outside the Qt binary folder, to some other more logical folder.

查看更多
一夜七次
6楼-- · 2019-02-24 07:57

What worked for me was the way I added headers in a .pri.

This works...

HEADERS += ../serialportwidget.h
HEADERS += ../serialportworker.h
SOURCES += ../serialportwidget.cpp
SOURCES += ../serialportworker.cpp

or this

HEADERS += ../serialportwidget.h \
../serialportworker.h
SOURCES += ../serialportwidget.cpp \
../serialportworker.cpp

This doesn't...

HEADERS += ../serialportwidget.h \ ../serialportworker.h
SOURCES += ../serialportwidget.cpp \ ../serialportworker.cpp
查看更多
登录 后发表回答