Errors compiling a plugin that uses Qt

Errors compiling a plugin that uses Qt

jmreinhart
Advisor Advisor
650 Views
2 Replies
Message 1 of 3

Errors compiling a plugin that uses Qt

jmreinhart
Advisor
Advisor

jonahrnhrt_0-1664718369356.png

I have a plugin that I have compiled successfully before for Windows, Mac, and Linux. But I have made some updates to it that required me to include some Qt headers. This didn't cause any issues when compiling on Windows and Mac, but when I try to compile on Linux I get the above error.

 

I have tried compiling using the qmake file provided by Maya in the devkit, and using Chad Vernon's cgcmake, and both of them encounter the same error. Does anybody know how to resolve this?

0 Likes
Accepted solutions (1)
651 Views
2 Replies
Replies (2)
Message 2 of 3

jmreinhart
Advisor
Advisor
Accepted solution

I did some more testing using the helixQtCmd example provided in the devkit.

 

The error occurs if I include M3Dview.h or MQUtil.h

(Those were the only two from the code I was trying to compile that caused the issue)

 

It looks like the issue is that:

 

M3Dview.h includes MNativeWindowHdl.h

which includes /usr/include/X11/Intrinsic.h  

which includes /usr/include/X11/xlib.h

and xlib.h defines some stuff like Bool, Status, and None

 

Note: MNativeWindowHdl.h only includes the xlib stuff if you are using Linux, which explains why Windows and Mac were not affected.

 

If found the solution here:

https://stackoverflow.com/questions/22476110/c-compiling-error-including-x11-x-h-x11-xlib-h

 

The solution is to "undef" the stuff that is causing conflicts:

#undef Bool
#undef CursorShape
#undef Expose
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef None
#undef Status
#undef Unsorted

and according to that stackoverflow forum you should also

" add LIBS += -lX11 in your .pro file"

My code compiled with and without that addition to the .pro file.

Message 3 of 3

jmreinhart
Advisor
Advisor

One thing I forgot to mention is that this fix works for compiling using the autodesk provided makefile and Chad Vernons cgcmake.

0 Likes