[Qt-creator] Code completion is unable to find header files
Sergey Shambir
sergey.shambir.auto at gmail.com
Mon Dec 31 16:57:22 CET 2012
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.
>>
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org <mailto:Qt-creator at qt-project.org>
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>
>>
>>
>>
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
More information about the Qt-creator
mailing list