[Qt-creator] Creator Can not locate Qt Headers

Ziller Eike Eike.Ziller at theqtcompany.com
Mon Nov 17 09:06:40 CET 2014

> 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)”.

> Of course I could be completely wrong about all of this…
> Thanks
> Mike Jackson
> PS: Installed a Ubuntu 14.04 desktop and QtCreator and that is what I call a "proper" debugging environment. Just wish I could have that on OS X.
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

Eike Ziller, Senior Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Qt-creator mailing list