Results 1 to 16 of 16

Thread: Added new class to clean Qt application, gotcompile error "No such file or directory"

  1. #1
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Added new class to clean Qt application, gotcompile error "No such file or directory"

    Hi,

    I'm fairly new to Qt.

    In a larger GUI programming project, on Linux with Qt Creator 5.2. Now I need to split things up and therefor make som tests

    I'm about to make a namespace test and in order for that, I create a new QApplication, compile out of the box - OK
    Next I add a new C++ class that inherit from QObject.
    Straight out of the box, it compiles

    Now when I add the class it fails to compile straight of with two errors
    Error: all: "No such file or directory"
    [first] Error 1

    Guess it has to do with paths missing but where??
    Suggestions??

    Qt Code:
    1. #include <QMainWindow>
    2.  
    3. namespace Ui { class MainWindow; }
    4.  
    5. class MainWindow : public QMainWindow
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. explicit MainWindow(QWidget *parent = 0);
    11. ~MainWindow();
    12.  
    13. ....
    14.  
    15.  
    16. #include <QObject>
    17.  
    18. class First : public QObject
    19. {
    20. Q_OBJECT
    21. public:
    22. explicit First(QObject *parent = 0);
    23.  
    24. signals:
    25. ...
    26.  
    27. // in .cpp
    28. #include "first.h"
    29.  
    30. First::First(QObject *parent) :
    31. QObject(parent)
    32. {
    33. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Which file does it not find?

    Cheers,
    _

  3. #3
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Hi anda_skoa

    Good question, this is all info the compiler sends out, 2 lines of error!!????

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    that's very unlikely.

    Make sure you are looking at the compile output tab

    Cheersm
    _

  5. #5
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Hi, yes I'm sure, attached a screenshot, as it looks (didn't display the code though
    NS-test-error.jpeg

  6. #6
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    This is not "compile output". Look at another tab where You see clean aoutput from compiler.

  7. #7
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    OK, another image then
    12849_0_NS-test-error2.jpg

  8. #8
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    gcc is looking for file all.

  9. #9
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    OK, so how does that happen??
    Shall I edit the makefile or what??

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    What does the project file look like?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Hi, Godmorning

    the .pro file looks like this
    Qt Code:
    1. -------------------------------------------------
    2. #
    3. # Project created by QtCreator 2015-03-03T02:16:46
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    10.  
    11. TARGET = t2
    12. TEMPLATE = app
    13.  
    14.  
    15. SOURCES += main.cpp\
    16. mainwindow.cpp \
    17. first.cpp
    18.  
    19. HEADERS += mainwindow.h \
    20. first.h
    21.  
    22. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 


    Added after 35 minutes:


    Leisok, I found this in the autogenerated makefile, Do you think it has something to do with it??
    QMAKE_TARGET = t2
    DESTDIR = #avoid trailing-slash linebreak
    TARGET = t2


    first: all
    ####### Implicit rules

    .SUFFIXES: .o .c .cpp .cc .cxx .C

    .cpp.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .cc.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .cxx.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .C.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .c.o:
    $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"

    ####### Build rules

    all: Makefile $(TARGET)
    Last edited by sundbergad; 6th March 2015 at 08:04.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Delete the Makefile and rebuild the project.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Deleted and rebuild, same problem. This is the compiler output
    19:54:21: Running steps for project t2...
    19:54:21: Starting: "/home/anders/Qt/5.2.0/gcc/bin/qmake" /home/anders/programmering/t2/t2.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
    19:54:21: The process "/home/anders/Qt/5.2.0/gcc/bin/qmake" exited normally.
    19:54:21: Starting: "/usr/bin/make"
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o first.o ../t2/first.cpp
    /home/anders/Qt/5.2.0/gcc/bin/uic ../t2/mainwindow.ui -o ui_mainwindow.h
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o main.o ../t2/main.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o mainwindow.o ../t2/mainwindow.cpp
    /home/anders/Qt/5.2.0/gcc/bin/moc -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. ../t2/mainwindow.h -o moc_mainwindow.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o moc_mainwindow.o moc_mainwindow.cpp
    /home/anders/Qt/5.2.0/gcc/bin/moc -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. ../t2/first.h -o moc_first.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../t2 -I../../Qt/5.2.0/gcc/include -I../../Qt/5.2.0/gcc/include/QtWidgets -I../../Qt/5.2.0/gcc/include/QtGui -I../../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o moc_first.o moc_first.cpp
    g++ -Wl,-rpath,/home/anders/Qt/5.2.0/gcc -Wl,-rpath,/home/anders/Qt/5.2.0/gcc/lib -o t2 main.o mainwindow.o first.o moc_mainwindow.o moc_first.o -L/home/anders/Qt/5.2.0/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    { test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9][^0-9]*\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 't2' && test -f t2.gdb-index && objcopy --add-section '.gdb_index=t2.gdb-index' --set-section-flags '.gdb_index=readonly' 't2' 't2' && rm -f t2.gdb-index || true
    gcc first.o all -o first
    gcc: error: all: No such file or directory
    make: *** [first] Error 1
    19:54:26: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project t2 (kit: Desktop Qt 5.2.0 GCC 32bit)
    When executing step 'Make'
    19:54:26: Elapsed time: 00:05.
    BTW, the clock is wrong, just ran the compiler with above result

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Do you have any extra build steps in your config?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    The problem seems to come from the filename "first"
    The Makefile has a standard target called "first", this seems to lead to a mixup with the rule for bulding first.o

    Try renaming first.h/.cpp to something else.

    Cheers,
    _

  16. The following user says thank you to anda_skoa for this useful post:

    sundbergad (9th March 2015)

  17. #16
    Join Date
    Mar 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Added new class to clean Qt application, gotcompile error "No such file or direct

    Hmmm, shall test to remove/rename first

    result
    Tested on my mac - same problem.
    Tested on my Linux - fixed problem

    Interesting, but not surprised, Linux is much easier to compile in (to get it to compile/working) than in my mac.

    Well ever the less, learned that I can't use the name first, or any other name that make uses.

    Thanks for the assistanse/help
    cheers and and have a nice weekend with happy coding to U

Similar Threads

  1. Replies: 12
    Last Post: 19th August 2015, 19:50
  2. Replies: 2
    Last Post: 20th September 2013, 23:47
  3. Replies: 2
    Last Post: 27th July 2011, 05:24
  4. Replies: 10
    Last Post: 9th September 2010, 17:43
  5. Replies: 3
    Last Post: 11th January 2009, 06:22

Tags for this Thread

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.