Results 1 to 13 of 13

Thread: Qt Creator produces "No such file or directory" error with existing file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by Coolname007 View Post
    Well, if Qt Creator knows where to find the file, and Qt Creator is the one that starts the compiler, then I would argue that Qt Creator should pass on that information to the compiler,
    No, it shouldn't. QtCreator doesn't implement a compiler, it's just an advanced code editor. If you have two files called the same way then it often happens that Creator opens the wrong one. I don't think you'd want it to force the compiler to open a wrong file, would you?

    since the user doesn't run the compiler directly when using the Qt Creator IDE.
    It is the project file that ultimately drives the compiler. If you set it up incorrectly then it will work incorrectly.

    Also, I see a flaw in your reasoning in that even if Qt Creator requires using the INCLUDEPATH variable
    I never said QtCreator requires using INCLUDEPATH. I said the compiler toolchain does.

    to explicitly specify the directories of each header file, outside of the #include declarations (which already includes that information
    Which points me to a conclusion that your #include directive probably doesn't match your project settings.
    in my case, even using INCLUDEPATH += PATH_TO_PROBLEM_FILE_DIRECTORY did not fix the problem.
    Show us your #include directive and your exact INCLUDEPATH statement and tell us where your project fil resides.

    Therefore, there
    must be a bug in the way Qt Creator passes on the information to the mingw32-make.exe utility, or else there wouldn't be a problem now, would there?
    Let's make a deal. If we manage to fix your problem and prove you there is no bug in "the way QtCreator passes information to make" then you'll donate not less than 100 EUR to QtCentre Foundation. Since as you said there must be a bug there, you don't risk anything. What do you say?
    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.


  2. #2
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by wysota View Post
    No, it shouldn't. QtCreator doesn't implement a compiler, it's just an advanced code editor. If you have two files called the same way then it often happens that Creator opens the wrong one. I don't think you'd want it to force the compiler to open a wrong file, would you?


    It is the project file that ultimately drives the compiler. If you set it up incorrectly then it will work incorrectly.
    And yet, I posted the complete project file in my last post...and did you see a problem in it??

    I never said QtCreator requires using INCLUDEPATH. I said the compiler toolchain does.
    Even that, I believe, is false, since I have built projects in Qt Creator before WITHOUT using the INCLUDEPATH variable (which is for qmake, btw, which is not a compiler...), and they worked and compiled just fine.

    Which points me to a conclusion that your #include directive probably doesn't match your project settings.
    Oh no?? Well, you see, the #include directive inside of every header or source file when using "" syntax refers to filepaths relative to the current directory of the file that contains it. Thus, when I wrote S_html_attr.h (located in C:/Users/MobileXMan/Documents/Programming_Projects/MAW/Modules/core/WebCoder_mod/modules/Html_coder/C_html4_coder/C_html4_elements/C_html4_tags/S_html_tag/C_html4_attributes/S_html_attr) which #include(s) S_html_attr_value.h (the problem file, located in C:/Users/MobileXMan/Documents/Programming_Projects/MAW/Modules/core/WebCoder_mod/modules/Html_coder/C_html4_coder/C_html4_elements/C_html4_tags/S_html_tag/C_html4_attributes/S_html_attr/S_html_attr_value), the #include directive (which mingw32-make.exe now points to when producing the "No such file or directory error") inside S_html_attr.h is:

    Qt Code:
    1. #include "S_html_attr_value/S_html_attr_value.h"
    To copy to clipboard, switch view to plain text mode 

    Show us your #include directive and your exact INCLUDEPATH statement and tell us where your project fil resides.
    I just gave you the #include directive. And I already gave you the exact INCLUDEPATH statement in my last post. As for where my project file resides, the full filepath is:

    C:/Users/MobileXMan/Documents/Programming_Projects/MAW/Modules/core/WebCoder_mod/modules/Html_coder/C_html4_coder/C_html4_elements

    Let's make a deal. If we manage to fix your problem and prove you there is no bug in "the way QtCreator passes information to make" then you'll donate not less than 100 EUR to QtCentre Foundation. Since as you said there must be a bug there, you don't risk anything. What do you say?
    Well, I dont think I'll agree to that deal (since I admit the problem could be somewhere else then where it looks like to me it is), but still, I could be right...

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

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    IMO should be either

    qmake Code:
    1. INCLUDEPATH += $$PWD/C_html4_tags/S_html_tag/C_html4_attributes/S_html_attr/S_html_attr_value
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. #include "S_html_attr_value.h"
    To copy to clipboard, switch view to plain text mode 

    or

    qmake Code:
    1. INCLUDEPATH += $$PWD/C_html4_tags/S_html_tag/C_html4_attributes/S_html_attr
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. #include "S_html_attr_value/S_html_attr_value.h"
    To copy to clipboard, switch view to plain text mode 


    BTW, this:

    Even that, I believe, is false, since I have built projects in Qt Creator before WITHOUT using the INCLUDEPATH variable (which is for qmake, btw, which is not a compiler...), and they worked and compiled just fine.
    can be simply countered by the following trial: build the project without using QtCreator, with pure qmake && make call.
    Last edited by wysota; 19th December 2012 at 17:02.
    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.


  4. #4
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by wysota View Post
    IMO should be either

    qmake Code:
    1. INCLUDEPATH += $$PWD/C_html4_tags/S_html_tag/C_html4_attributes/S_html_attr/S_html_attr_value
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. #include "S_html_attr_value.h"
    To copy to clipboard, switch view to plain text mode 

    or

    qmake Code:
    1. INCLUDEPATH += $$PWD/C_html4_tags/S_html_tag/C_html4_attributes/S_html_attr
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. #include "S_html_attr_value/S_html_attr_value.h"
    To copy to clipboard, switch view to plain text mode 


    BTW, this:



    can be simply countered by the following trial: build the project without using QtCreator, with pure qmake && make call.
    Hmm...I see. I wasn't aware that the INCLUDEPATH variable effects the #include declarations in that way.
    In the documentation, on the "qmake Variable Reference" page, it says the following about the INCLUDEPATH variable:

    This variable specifies the #include directories which should be searched when compiling the project.
    I interpreted that to mean "it specifies the additional include directories which should be searched when compiling the project".
    But now, I see, the emphasis should be on the #include part...

    I posted about this same problem on the qtforum.org forums, and was basically just told the same thing.

    However, while I was trying that, I discovered the real problem must have been in the .pro.user file I was using before, since when I re-setup the project for the Desktop platform (because I had opened it in my other OS - Ubuntu - installed as a dualboot on the same development computer, and the .pro.user settings were different), and the file was rewritten, I have now gotten past that error. So it seems it must have been an issue with the settings. I noticed that this time when I set it up, I chose the "None" option for the build configuration, instead of choosing "One Debug and One Release for each Qt version" like I had the last time (I believe...), so maybe that had something to do with it, I don't know. Anyway, its fixed now.

    Thanks.
    Last edited by Coolname007; 19th December 2012 at 17:38.

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

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by Coolname007 View Post
    Hmm...I see. I wasn't aware that the INCLUDEPATH variable effects the #include declarations in that way.
    INCLUDEPATH is no magic. It merely passes its contents to the compiler with the "-I" parameter.

    I interpreted that to mean "it specifies the additional include directories which should be searched when compiling the project".
    No, that is the work of DEPENDPATH. INCLUDEPATH is for includes only. But this has no influence on your current situation.

    However, while I was trying that, I discovered the real problem must have been in the .pro.user file I was using before,
    .pro.user file is not used for compilation. It merely contains QtCreator settings (of course including settings for running the compiler, but it only states which compiler to run (by passing options to qmake that parses the .pro file), not what directories it should search for include files). The .pro file controls compilation process.
    Last edited by wysota; 19th December 2012 at 18:54.
    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.


  6. #6
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by wysota View Post
    INCLUDEPATH is no magic. It merely passes its contents to the compiler with the "-I" parameter.


    No, that is the work of DEPENDPATH. INCLUDEPATH is for includes only. But this has no influence on your current situation.


    .pro.user file is not used for compilation. It merely contains QtCreator settings (of course including settings for running the compiler, but it only states which compiler to run (by passing options to qmake that parses the .pro file), not what directories it should search for include files). The .pro file controls compilation process.
    Well, how do you explain then that once the .pro.user file got rewritten and I removed the INCLUDEPATH statement from the .pro file, and tried to build, I'm no longer getting the "No such file or directory" error?

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

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by Coolname007 View Post
    Well, how do you explain then that once the .pro.user file got rewritten and I removed the INCLUDEPATH statement from the .pro file, and tried to build, I'm no longer getting the "No such file or directory" error?
    I will not even try explaining that. I could if I had contents of both your projects so that I could compare them (especially the .pro files). I just know how both QtCreator and compilers work and I know the error such as you got is not caused by QtCreator.
    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.


  8. #8
    Join Date
    Aug 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Creator produces "No such file or directory" error with existing file

    Quote Originally Posted by Coolname007 View Post
    Hmm...I see. I wasn't aware that the INCLUDEPATH variable effects the #include declarations in that way.
    In the documentation, on the "qmake Variable Reference" page, it says the following about the INCLUDEPATH variable:



    I interpreted that to mean "it specifies the additional include directories which should be searched when compiling the project".
    But now, I see, the emphasis should be on the #include part...

    I posted about this same problem on the qtforum.org forums, and was basically just told the same thing.

    However, while I was trying that, I discovered the real problem must have been in the .pro.user file I was using before, since when I re-setup the project for the Desktop platform (because I had opened it in my other OS - Ubuntu - installed as a dualboot on the same development computer, and the .pro.user settings were different), and the file was rewritten, I have now gotten past that error. So it seems it must have been an issue with the settings. I noticed that this time when I set it up, I chose the "None" option for the build configuration, instead of choosing "One Debug and One Release for each Qt version" like I had the last time (I believe...), so maybe that had something to do with it, I don't know. Anyway, its fixed now.

    Thanks.
    I'm on Linux and had the same problem. My solution was to use xterm and set the default Terminal in Qtcreator to xterm (In the menu: Tools, then Options, then Environment, then Terminal, there "/usr/bin/xterm -e")

Similar Threads

  1. Replies: 5
    Last Post: 15th August 2014, 03:04
  2. Replies: 4
    Last Post: 26th July 2010, 07:02
  3. Replies: 1
    Last Post: 23rd June 2010, 06:03
  4. Replies: 9
    Last Post: 20th May 2010, 09:55
  5. Replies: 3
    Last Post: 8th July 2008, 19:37

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
  •  
Qt is a trademark of The Qt Company.