[Qt-creator] Creator Can not locate Qt Headers

Michael Jackson imikejackson at gmail.com
Mon Nov 17 15:50:05 CET 2014


On Nov 17, 2014, at 3:06 AM, Ziller Eike <Eike.Ziller at theqtcompany.com> wrote:

> 
>> On Nov 15, 2014, at 4:02 AM, Michael Jackson <imikejackson at gmail.com> wrote:
>> 
>> 
>> On Nov 14, 2014, at 3:34 AM, Nikolai Kosjar <nikolai.kosjar at theqtcompany.com> wrote:
>> 
>>> Hi!
>>> 
>>> On Thu, 13. Nov 12:36, Michael Jackson wrote:
>>>> The issue is that QtCreator can not seem to locate any Qt Header. There is a red squiggly line under #include <QtCore/QObject> and then none of the syntax highlighting works after that.
>>> 
>>> Please check what the Code model gets as input from the Project
>>> (managers):
>>> 
>>> 1) Open a file with unresolved includes
>>> 2) Open Menu: Tools > C++ > Inspect C++ Code Model
>>> 3) There, switch to the "Project Parts" tab and the sub tab "Header
>>> Paths" - check that the includes are reasonable, especially that there
>>> is sth. like ${PATH_TO_QT_INSTALL}/5.4/gcc_64/include/QtCore 
>>> 
>>> Nikolai
>>> 
>> Here are some of the include paths for the project:
>> 
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtConcurrent.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtCore.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtGui.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtNetwork.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtOpenGL.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtPrintSupport.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtScript.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtSvg.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtWidgets.framework/Headers (include path)
>> /Users/Shared/Toolkits/Qt-5.3.1/lib/QtXml.framework/Headers (include path)
>> 
>> I will guess that the code model does not under stand the combination of
>> 
>> #include <QtCore/QObject> and that file residing in a framework on OS X. In my Qt4 build there is an actual Qt-4.8.6/include/QtCore/QObject file for the include which is why it works under Qt4. With Qt5 "proper" frameworks have been created where the headers are installed into the frameworks and QtCreator's code model just does not understand how to parse apart a framework.
>> 
>> I guess I could change all my #include to remove the module but that really should not be needed as the code compiles just fine the way it is (on all platforms).
> 
> The notation “#include <QtCore/QObject>” to denote an include within a framework needs a corresponding framework path setting to where the QtCore framework resides. In your case you need a flag “-F/Users/Shared/Toolkits/Qt-5.3.1/lib” for the compiler, and in the Header Paths in Qt Creator an entry "/Users/Shared/Toolkits/Qt-5.3.1/lib (framework path)”.

Yes. It compiles fine so the Compiler flags are correctly inserted. From the "Inspect Code Model->Project Parts->Header Paths"
 /Users/Shared/Toolkits/Qt-5.3.1/lib (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/.. (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtConcurrent.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtCore.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtGui.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtNetwork.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtOpenGL.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtPrintSupport.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtScript.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtSvg.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtWidgets.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtXml.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/mkspecs/macx-clang (include path)


Can I manually add an include path?

Thanks
Mike Jackson




More information about the Qt-creator mailing list