Results 1 to 11 of 11

Thread: Qt Creator Not Recognizing my own header file.

  1. #1
    Join Date
    Jan 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt Creator Not Recognizing my own header file.

    My .pri file called widgets.pri:
    SOURCES += \
    internal_lib/widgets/sheet_wp.cpp

    HEADERS += \
    internal_lib/widgets/sheet_wp.h

    My .pro file has this include:
    include(internal_lib/widgets/widgets.pri)

    Everything was working fine but suddenly I get the following error:
    error: C1083: Cannot open include file: 'internal_lib/widgets/sheet_wp.h': No such file or directory

  2. #2
    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: Qt Creator Not Recognizing my own header file.

    You probably need a proper INCLUDEPATH as well. Or even that and also DEPENDPATH.
    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.


  3. #3
    Join Date
    Jan 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Not Recognizing my own header file.

    Yes, those are there but still not recognizing them:

    INCLUDEPATH += $$PWD
    DEPENDPATH += $$PWD

    Edit: Odd. I've removed the files and even added (existing) files, so that the .pri file does its auto stuff, it still doesn't recognize only that file (I have other files that are recognized fine).
    Last edited by Plissken; 18th July 2012 at 07:04.

  4. #4
    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: Qt Creator Not Recognizing my own header file.

    How are you including the file in your sourcecode?
    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.


  5. #5
    Join Date
    Jan 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Not Recognizing my own header file.

    #include "internal_lib/widgets/sheet_wp.h"

  6. #6
    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: Qt Creator Not Recognizing my own header file.

    How about this:

    qmake Code:
    1. INCLUDEPATH += internal_lib/widgets
    To copy to clipboard, switch view to plain text mode 

    and then:

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

    Does it change anything?
    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.


  7. #7
    Join Date
    Jan 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Not Recognizing my own header file.

    No, it doesn't. Same error message. This project folder I had cloned from a git repository. I wonder if that has anything to do with it? When I open the .pro file for the first time, it asked whether I wanted to load the .user setting files (but it recommends that I don't) so I just clicked no.

    The weird thing is that the code compiles fine on the computer that this project was originally created on.
    Last edited by Plissken; 19th July 2012 at 00:23.

  8. #8
    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: Qt Creator Not Recognizing my own header file.

    Can we see the actual compiler invokation that fails?
    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.


  9. #9
    Join Date
    Jan 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Not Recognizing my own header file.

    error: C1083: Cannot open include file: 'internal_lib/widgets/sheet_wp.h': No such file or directory

  10. #10
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Not Recognizing my own header file.

    compiler command, not error
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  11. #11
    Join Date
    Jan 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Not Recognizing my own header file.

    I got this working. I don't know the exactly why it got it working, but I was reading the definition of PWD in the Qt Docs and a word that caught my eye in the definition was shadow build. I realized in the original project which did compile correctly was using shadow building, but the same project I loaded on a different computer was not using shadow building. Once I enabled shadow building (and this must be done when the pro file is loaded for the first time, not later on) it started compiling without errors. Thanks wysotta for your help.
    Last edited by Plissken; 20th July 2012 at 07:05. Reason: updated contents

Similar Threads

  1. Why don't Qt Creator projects recompile after header changes?
    By tksharpless in forum Qt Programming
    Replies: 5
    Last Post: 19th October 2011, 17:20
  2. Qt Creator Using alternate openGL library/header files in QT Creator
    By Willybood in forum Qt Tools
    Replies: 2
    Last Post: 24th May 2011, 09:06
  3. Recognizing file or directory
    By AD in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2008, 16:18
  4. QTcpSocket not recognizing disconnect
    By jimroos in forum Qt Programming
    Replies: 3
    Last Post: 6th September 2007, 15:31
  5. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13

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.