On 06/19/2010 05:28 PM, Ivan Vodopiviz wrote:
> Hi all, I'm new to this list.
>
> I'm experiencing some weird behavior with a SDL-based project I
> migrated to qmake/QT Creator under Ubuntu. I installed SDL using the
> package manager, so the include directory is located at /usr/include/.
> Since QT Creator couldn't find it, I added INCLUDEPATH += /usr/include
> to my .pro file. Of course, I also added a LIBS entry.
>
> And that's when things get weird: The project compiles and runs just
> fine. References to<SDL/SDL.h>

The correct way to include SDL headers is:

   #include <SDL.h>

That is, no "SDL/" prefix.  On your system the SDL headers might be 
installed in /usr/include/SDL, but not on other systems (for example, it 
might be include/SDL-1.2/).  To get the actual include directory, you 
either use pkg-config or sdl-config.  In your .pro file:

   QMAKE_CFLAGS += $$system(sdl-config --cflags)
   QMAKE_CXXFLAGS += $$system(sdl-config --cflags)


> in most of my source files get
> resolved just fine, with my main.cpp being the only exception. For
> some reason, QT Creator keeps underlining the #include statement
> complaining that it wasn't able to find SDL.h.

This is solved with a little trick in your pro file:

   # This is just a hack to make code completion work OK in Qt Creator.
   INCLUDEPATH += /usr/include/SDL
   INCLUDEPATH -= /usr/include/SDL
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator

Reply via email to