BarChartQt example does not compile

I downloaded the tar file from the website (very recently) and I get a compilation error (to ensure it was not a Qt install problem I compiled the BorderWidgetQt example successfully).

[ 33%] Building CXX object CMakeFiles/BarChartQt.dir/BarChartQt.cxx.o
/home/briand/src/cc/vtk/BarChartQt/BarChartQt.cxx: In constructor ‘BarChartQt::BarChartQt(QWidget*)’:
/home/briand/src/cc/vtk/BarChartQt/BarChartQt.cxx:68:22: error: invalid use of incomplete type ‘class vtkPen’
   68 |   xAxis->GetGridPen()->SetColor(colors->GetColor4ub("Black"));
      |                      ^~
In file included from /home/briand/src/cc/vtk/BarChartQt/BarChartQt.cxx:4:
/usr/include/vtk-9.1/vtkAxis.h:62:7: note: forward declaration of ‘class vtkPen’
   62 | class vtkPen;
      |       ^~~~~~
/home/briand/src/cc/vtk/BarChartQt/BarChartQt.cxx:77:22: error: invalid use of incomplete type ‘class vtkPen’
   77 |   yAxis->GetGridPen()->SetColor(colors->GetColor4ub("Black"));
      |                      ^~
/usr/include/vtk-9.1/vtkAxis.h:62:7: note: forward declaration of ‘class vtkPen’
   62 | class vtkPen;
      |       ^~~~~~
/home/briand/src/cc/vtk/BarChartQt/BarChartQt.cxx:89:19: error: invalid use of incomplete type ‘class vtkContextScene’
   89 |   view->GetScene()->AddItem(chart);
      |                   ^~
In file included from /usr/include/vtk-9.1/vtkContextItem.h:28,
                 from /usr/include/vtk-9.1/vtkAxis.h:55:
/usr/include/vtk-9.1/vtkAbstractContextItem.h:36:7: note: forward declaration of ‘class vtkContextScene’
   36 | class vtkContextScene;
      |       ^~~~~~~~~~~~~~~

This is probably due to a missing element of the CMakeLists.txt find_package specifier (maybe?) but I’m unsure how to figure out what that specifier might be.

I tried to diff against the BorderWidgetQt CMakeLists.txt file but none of the packages I added from BorderWidgetQt fixed the problem.

p.s. I think the real question here is, given that I know vtkPen, VtkContextScene are the problem how do I figure out the module that provides them ? Looking up vtkContextScene in the class reference doesn’t seem to provide the answer.

Reading comprehension problem.

I didn’t read the messages carefully, they are declaration errors not link errors.

Simply add

#include <vtkPen.h>
#include <vtkContextScene.h>

and it compiles !

Looks like they are missing from the example, do you want to add them ?

Sure ! I did make a half-hearted attempt to figure out which tree to checkout to submit a PR, I was having a bit of trouble finding which repo held BarChartQt.cxx, it seemed like one repo pointed to another repo which then had a bunch of tar files but no .cxx file.

I’ll make a whole-hearted attempt :slight_smile:

The bad news is that I’ll then have to remember how to submit a PR :laughing:

I got the tree checked out , made the changes (in a new branch), committed but got stuck on how to push them and make the necessary merge request.

did you create a fork of the examples ?

sorry for the delay.
I realize this is painful for you, sorry but I’m not very good with git :frowning:
I’m not sure what you mean by fork.
I did clone the tree and then started a new branch and made the changes in that branch.
Is a fork something different ?