Results 1 to 5 of 5

Thread: compilation errors "gcc: all: No such file or directory"

  1. #1
    Join Date
    May 2010
    Posts
    12
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default compilation errors "gcc: all: No such file or directory"

    Qt Code:
    1. #include <QApplication>
    2. #include <QDebug>
    3.  
    4. int main(int argc,char*argv[]){
    5.  
    6. QApplication a(argc,argv);
    7. qDebug()<<"Helloworld";
    8.  
    9. return 0;
    10. }
    To copy to clipboard, switch view to plain text mode 

    sample_pr_commandline.pro file:

    TEMPLATE = app
    TARGET =
    DEPENDPATH += .
    INCLUDEPATH += .

    # Input
    SOURCES += first.cpp


    namus@namus-desktop:~/Sample_Qt_progs/sample_pr_commandline$ ls
    first.cpp sample_pr_commandline.pro
    namus@namus-desktop:~/Sample_Qt_progs/sample_pr_commandline$ qmake
    namus@namus-desktop:~/Sample_Qt_progs/sample_pr_commandline$ ls
    first.cpp Makefile sample_pr_commandline.pro

    namus@namus-desktop:~/Sample_Qt_progs/sample_pr_commandline$ make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o first.o first.cpp
    g++ -Wl,-O1 -o sample_pr_commandline first.o -L/usr/lib -lQtGui -lQtCore -lpthread
    gcc first.o all -o first
    gcc: all: No such file or directory
    make: *** [first] Error 1

    Makefile is attached to this thread.
    I am not getting why this error is coming & other programs are running fine.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: compilation errors "gcc: all: No such file or directory"

    It looks like it can't find first.o

    Can you do an ls in the build directory after the compilation error?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: compilation errors "gcc: all: No such file or directory"

    Make is confusing a target "first" generated by qmake in the Makefile with the file "first" and related targets. Rename your source file.

  4. The following user says thank you to ChrisW67 for this useful post:

    lunac (22nd November 2013)

  5. #4
    Join Date
    May 2010
    Posts
    12
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: compilation errors "gcc: all: No such file or directory"

    Thanks Chris,
    After renaming the first.cpp to myprog.cpp, works fine .
    but i didnt clearly understood the reason , can u explain in detail !!!

  6. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: compilation errors "gcc: all: No such file or directory"

    The Makefile contains a generated (fake) target called "first" and it also contains a set of explicit and implied rules related to the source file "first.cpp". The make command builds your TARGET (which is named after the directory if not specified) and then decides that because "first.o" changed it must rebuild the "first" target: at this point it gets confused.
    Qt Code:
    1. $ make
    2. /usr/bin/moc -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -I. first.cpp -o first.moc
    3. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -I. -o first.o first.cpp
    4. g++ -Wl,-O1 -Wl,-rpath,/usr/lib/qt4 -o simple_example first.o -L/usr/lib/qt4 -lQtSql -L/usr/lib/mysql -L/usr/lib/qt4 -lQtGui -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
    5. gcc first.o all -o first // <<<<< confused, decides to rebuild "first" target using a file called "all"
    6. gcc: all: No such file or directory
    7. make: *** [first] Error 1
    To copy to clipboard, switch view to plain text mode 
    You get similar confusion (that make recovers from) if "TARGET = first" even with no files called "first.cpp".
    Qt Code:
    1. $ make
    2. /usr/bin/moc -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -I. main.cpp -o main.moc
    3. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -I. -o main.o main.cpp
    4. make: Circular all <- first dependency dropped. // <<<< confused but recognises the situation
    5. g++ -Wl,-O1 -Wl,-rpath,/usr/lib/qt4 -o first main.o -L/usr/lib/qt4 -lQtSql -L/usr/lib/mysql -L/usr/lib/qt4 -lQtGui -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
    To copy to clipboard, switch view to plain text mode 

    Adding
    Qt Code:
    1. .PHONY = first
    To copy to clipboard, switch view to plain text mode 
    to Makefile fixes this problem but probably generates another if the TARGET = first. The change would be overwritten by qmake anyway. Easier to just avoid it.

Similar Threads

  1. Replies: 1
    Last Post: 23rd June 2010, 07:03
  2. Replies: 9
    Last Post: 20th May 2010, 10:55
  3. Replies: 3
    Last Post: 15th February 2010, 18:27
  4. Replies: 3
    Last Post: 8th July 2008, 20:37
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.