openhumanoids / signal-scope

A live plotting tool for LCM message fields.
BSD 3-Clause "New" or "Revised" License
13 stars 17 forks source link

QWT version check is slightly wrong #13

Closed rdeits closed 8 years ago

rdeits commented 8 years ago

From 6.832X piazza:

The error is:

drake-distro/externals/signalscope/src/signal_scope/plot.cpp:83:63: error: cannot convert ‘const QwtScaleDiv’ to ‘const QwtScaleDiv*’ in initialization
       const QwtScaleDiv* scaleDiv = mPlot->axisScaleDiv( axis );
                                                               ^
src/signal_scope/CMakeFiles/signal-scope.dir/build.make:527: recipe for target 'src/signal_scope/CMakeFiles/signal-scope.dir/plot.cpp.o' failed
make[7]: *** [src/signal_scope/CMakeFiles/signal-scope.dir/plot.cpp.o] Error 1
CMakeFiles/Makefile2:106: recipe for target 'src/signal_scope/CMakeFiles/signal-scope.dir/all' failed
make[6]: *** [src/signal_scope/CMakeFiles/signal-scope.dir/all] Error 2

And one of the students pointed out that:

Oh, that one. The code is using an incorrect #if QWT_VERSION < something preprocessor directive to decide whether the qwt method is returning a pointer or not. The fix is to add & before the method call, just like it is written in the #else part. I completely forgot to report that error... Well, the actual fix would be to find out which qwt version changed things and fix the #if ... directive, but that would require digging through qwt's changelog files or git logs or something like that. Edit: I took a look at the svn repo for qwt and it seams the last version using the pointer returns is 6.0.2, while all 6.1.x versions return a reference. So, the code should be changed from "#if QWT_VERSION < 0x060102" to "#if QWT_VERSION < 0x060100" (just the 2 at the end has to become 0). Therefore, you can either change that #if, or just use &mPlot->axis... in both branches.

brcha commented 8 years ago

Hello,

Yes, you have noticed the API change in version 6.1.2, while the change was introduced with 6.1.0. Apparently, *ubuntu 15.04 is using qwt 6.1.1 which falls exactly between.

Here are the source files in the last version before the 6.1.x branch:

qwt_plot.h from 6.0.2

and in the first version of the 6.1.x branch:

qwt_plot.h from 6.1.0

Simply dropping the limit to 0x060100 should do the trick.