[Qt-creator] Code completion is unable to find header files

Nikos Chantziaras realnc at gmail.com
Mon Dec 31 18:56:57 CET 2012


But if it exists, it will not be ignored, which is a problem.  For 
example, the include like should be:

   -I/usr/local/SDL-1.2

*not*:

   -I/usr/local/SDL -I/usr/local/SDL-1.2

Also not:

   -I/usr/local/SDL-1.2 -I/usr/local/SDL

Yes, this is a Creator issue with code completion.  It does not affect 
the build.  I need to get Creator to understand that "SDL.h" is in 
/usr/include/SDL.

On 31/12/12 17:57, Sergey Shambir wrote:
> If file listed in INCLUDEPATH not exists, it will be ignored.
>
>           CONFIG += link_pkgconfig
>           PKGCONFIG += sdl
>
> This settings ignored only by QtCreator C++ engine or build fails too?
>
> 31.12.2012 14:33, Nikos Chantziaras пишет:
>> I forgot to mention that I know about this, but this can potentially
>> also break portability, since it might preempt the directory reported by
>> pkg-config.
>>
>>
>> On 31/12/12 12:26, Orgad Shaneh wrote:
>>> Add in your pro file:
>>> INCLUDEPATH += /usr/include/SDL
>>>
>>>
>>> On Mon, Dec 31, 2012 at 12:19 PM, Nikos Chantziaras <realnc at gmail.com
>>> <mailto:realnc at gmail.com>> wrote:
>>>
>>>       I've run into a nasty problem with Qt Creator (I'm using 2.6.1 on Gentoo
>>>       Linux) where it can't find header files I include and thus code
>>>       completion for anything in those headers isn't working.
>>>
>>>       Case in point:
>>>
>>>           #include <SDL.h>
>>>
>>>       Creator can't find it because the full path to that header is:
>>>
>>>           /usr/include/SDL/SDL.h
>>>
>>>       However, I don't want to use:
>>>
>>>           #include <SDL/SDL.h>
>>>
>>>       instead.  That's not the correct way to do it, as it breaks portability.
>>>          Some systems don't use "SDL/" but can have that header in
>>>       "SDL1.2/" or
>>>       "SDL12/" or "SDL-1.2/" or whatever.  The correct way to do this is to
>>>       use pkg-config.  In my project file:
>>>
>>>           CONFIG += link_pkgconfig
>>>           PKGCONFIG += sdl
>>>
>>>       Qt Creator is not able to pick that up.  So as a workaround, which seems
>>>       to work fine with generic projects, I provided a "ProjectName.includes"
>>>       file with this in it:
>>>
>>>           /usr/include/SDL
>>>
>>>       But Creator doesn't seem to care.  This works just fine for non-qmake
>>>       projects.  But with qmake projects, Creator seems to ignore *.includes
>>>       files?
>>>
>>>       What can I do?
>>>
>>>       This is of course not limited to SDL. The same problem arises with
>>>       anything that uses pkg-config to provide include paths and you're not
>>>       supposed to hardcode the path prefix into your #include directives.





More information about the Qt-creator mailing list