[Qt-creator] #ifdef Linux - code coloring
Eike Ziller
eike.ziller at nokia.com
Mon May 18 09:51:31 CEST 2009
Hi,
On May 18, 2009, at 8:51 AM, ext Liebe Markus (RtP2/TEF72) wrote:
> Hi,
>
> In a project I have several code sections that are specific for
> Windows or Linux. To seperate them I use:
> #ifdef Linux
> // code
> #endif
>
> As well as
> #ifdef WIN32
> // code
> #endif
>
> In QtCreator both sections in between the preprocessor commands
> remain gray.
> There is no more syntax highlighting and it looks as if LINUX was
> not defined.
> Although I have specified both defines in the .pro file in a
> conditional part.
> Resulting in the existing -DLINUX on Linux and -DWIN32 on Windows.
> See attached screenshot.
>
> Is there anything wrong on how I use the defines? Or is there a
> problem with QtCreator and its code coloring?
It's a known problem, and I hate to say that we still haven't fixed
that (the "right" way) :(. The problem is that we don't read DEFINES
from pro files.
There is actually a workaround for your specific usecase though:
Use the Q_OS_LINUX and Q_OS_WIN32 defines that are defined by Qt.
(e.g. http://doc.qtsoftware.com/4.5/qtglobal.html#Q_OS_LINUX)
Regards,
--
Eike Ziller
Software Engineer
Nokia, Qt Software
Phone +49 (0)30 6392 3255
Fax +49 (0)30 6392 3256
E-mail eike.ziller at nokia.com
More information about the Qt-creator-old
mailing list