[Interest] Compiler Error from moc_MainWindow.cpp

Karl Ruetz karl.ruetz at ruetzdogz.com
Fri Sep 6 19:30:37 CEST 2013


 

For your particular case, you should be able to just us a "#undef
Bool" after the #include <Xlib.h> line. 

Or, if you use Xlib.h in many
modules, you can create your own mitchsXlib.h and put this in there.


Or, you could grep the Qt4 sources for Xlib.h and see how they did it.


Karl 

On 2013-09-06 11:09, Mitchell Verter wrote: 

> Thanks for your
response, Thiago.
> 
> So your intutiion was correct: the error is
coming from exacty a line that says
> 
> #define Bool int
> 
> However,
this line is located in the the X11 libraries, in Xlib.h.
> 
> I was
using X11 to inject mouse clicks into the application.
> 
> I had no
problems using Xlib.h when I was using Qt4 but I am having problems in
Qt5. Why would this be? What should I do to rectify it? I am reluctant
to start chopping away at X11 header files.
> 
> thanks mitchell 
> 
>
On Fri, Aug 30, 2013 at 9:02 PM, Thiago Macieira
<thiago.macieira at intel.com> wrote:
> 
>> On sexta-feira, 30 de agosto de
2013 16:41:12, Mitchell Verter wrote:
>> > moc_MainWindow.cpp:104:50:
error: expected unqualified-id before 'int'
>> >
moc_MainWindow.cpp:104:50: error: expected '}' before 'int'
>> 
>>> 104:
QMetaType::Void, QMetaType::UInt, QMetaType::Bool, 2, 2,
>> 
>> Note how
there's no "int" on that line.
>> 
>> Whenever you get an error that
doesn't make sense, it's likely to be a
>> preprocessor problem.
>> 
>>
My guess:
>> #define Bool int
>> 
>> Solution:
>> get a big axe and
apply to the C header that does such things
>> 
>> If you need booleans
in C code, use this:
>> 
>> #ifndef __cplusplus
>> # include
<stdbool.h>
>> #endif
>> 
>> Then use regular bool.
>> --
>> Thiago
Macieira - thiago.macieira (AT) intel.com [1]
>> Software Architect -
Intel Open Source Technology Center
>> 
>>
_______________________________________________
>> Interest mailing
list
>> Interest at qt-project.org
>>
http://lists.qt-project.org/mailman/listinfo/interest [2]
> 
>
_______________________________________________
> Interest mailing
list
> Interest at qt-project.org
>
http://lists.qt-project.org/mailman/listinfo/interest [2]




Links:
------
[1] http://intel.com
[2]
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130906/973a8e04/attachment.html>


More information about the Interest mailing list