QT creator Cannot open source file



  • Hi all:
    I just create a GUI project in a choosed path (windows system),befor add any code in this project ,I clicked the button:Run,only to find this error :Cannot open file:'.\main.cpp':No such file or directory .But actually it has such a file:created by the Qt itself ! so How Could I fix this issue ? thank you !
    ps:this issue hasn't occured when I use VS to create a same QT GUI project.


    大家好:
    我使用qt creator 创建了一个GUI的工程,工程路径是自己制定的,使用windows 系统。建立好了之后,我运行,发现他弹出这个错误提示:Cannot open file:'.\main.cpp':No such file or directory。事实上这是Qt自己完成的,我没有改动任何东西。请问我应该如何修改这个问题,谢谢。
    ps:我用vs建立Qt工程没有出现这个问题,两者使用的是同一个qt。



  • what type of project you created ? Do you see the main.cpp in Project explorer on the left side of your Qt creator ? Can you create new project and try ? Can you clean, run the qmake again and give build ?



  • @Dheerendra Dheerendra
    project type:Qt4 Gui Application
    I can see the main.cpp
    I can create new project but can't run as the same reason;
    I can clean and qmake that pro.,but when run it ,give me the error msg :
    Cannot find source file :‘.\main.cpp’ No such file or directory
    Cannot find source file :‘.\mainwindow.cpp’ No such file or directory

    the project name is testAgain,in that *.pro file I can see the info.as belowe:
    #---------------------------------------------

    project cerate by Qt Creator 2014-09-05t09:53:21

    #---------------------------------------------
    TARGET = testAgain
    TEMPLATE = app
    SOURCES += main.cpp
    mainwindow.cpp
    HEADERS += mainwindow.h
    FORM += mainwindow.ui

    so you can see I haven't change anyting before add my owner code to this project ,it just cannot work.
    The strange is ,if I use VS to create the same Qt project ,nothing go wrong ! But I need to use Qt creator in a straightway > _ <


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.