[vtkusers] Support of C++ Builder with VTK 5.10 and newer

Neil Crawford crawfsoldan at yahoo.com
Sat Dec 29 03:03:43 EST 2012


On Tue, 4 Sep 2012 20:41:09
+0000, James Johnston said:
> the internal compiler
error on vtkExtractSelectedIds turned into this with VTK 5.10 / C++ Builder
XE2:
> 
> C:\Users\JamesJ\Documents\Repositories\VTK-source\VTK\Graphics\vtkExtractSelectedIds.cxx:
> Error E2027
> C:\Users\JamesJ\Documents\Repositories\VTK-source\VTK\Graphics\vtkExtractSelectedIds.cxx 
> 337: Must take address of a memory location in function
void
> vtkExtractSelectedIdsExtractCells<vtkStdString,vtkStdString>(vtkExtractSelectedIds
*,int,int,vtkDataSet > *,vtkIdTypeArray
*,vtkSignedCharArray *,vtkSignedCharArray *,int,vtkStdString *,vtkStdString *)
> Error E2342
> C:\Users\JamesJ\Documents\Repositories\VTK-source\VTK\Graphics\vtkExtractSelectedIds.cxx 
> 337: Type mismatch in
parameter '_Right' (wanted 'const std::string &', got 'vtkStdString') in
function
> void vtkExtractSelectedIdsExtractCells<vtkStdString,vtkStdString>(vtkExtractSelectedIds 
> *,int,int,vtkDataSet
*,vtkIdTypeArray *,vtkSignedCharArray *,vtkSignedCharArray *,int,vtkStdString 
> *,vtkStdString *)
 
Using Embarcadero C++ Builder
XE3 to compile VTK 5.10.1 I tried to follow the recipe provided by Oliver
Weinheimer for VTK 5.8, but I also ran into these same errors in Graphics\vtkExtractSelectedIds.cxx.
 
These errors are all related
to expressions that include static_cast<T1> or static_cast<T2>,
which the Embarcadero compiler seems to have some trouble with when included in longer expressions.  However, it compiles if an extra line is added
with a temporary intermediate variable (I don’t really understand why).  For example, replacing the following line
idLessThanLabel =(id[idArrayIndex]
< static_cast<T1>(label[labelArrayIndex]));
with these 2 lines
T1 temp=
static_cast<T1>(label[labelArrayIndex]);
idLessThanLabel =(id[idArrayIndex]
<temp);
compiles without errors.
 
Additionally, I dealt with errors
that seem to be new with VTK 5.10 and Embarcadero (or that were overcome before just by excluding) as follows:

Charts\vtkColorLegend.cxx
'Delete' is not a member of
vtkTextProperty', because the type is not yet defined in function
~vtkNew<vtkTextProperty>::vtkNew()
 - added
#include
"vtkTextProperty.h"
to vtkColorLegend.h
 
Rendering\vtkWin32OpenGLRenderWindow.cxx:
Error E2451 C:\VTK510\VTK510\Rendering\vtkWin32OpenGLRenderWindow.cxx
1005: Undefined symbol ‘intptr_t’ in function
vtkWin32OpenGLRenderWindow::CreateAWindow()
- added

#include <stdint.h> 
to
vtkWin32OpenGLRenderWindow.h
 
Charts\vtkPlotBar.cxx and
Charts\vtkPlotStacked.cxx
Error E2034
C:\VTK510\VTK510\Charts\vtkPlotStacked.cxx 135: Cannot convert 'vtkSmartPointer<vtkPoints2D>'
to 'int' in function vtkPlotStackedSegment::Configure(vtkPlotStacked *,vtkDataArray
*,vtkDataArray *,vtkPlotStackedSegment *)
Error E2285
C:\VTK510\VTK510\Charts\vtkPlotStacked.cxx 135: Could not find a match for
'CopyToPointsSwitch<A>(vtkSmartPointer<vtkPoints2D>,undefined,double
*,vtkDataArrayk *,int)' in function vtkPlotStackedSegment::Configure(vtkPlotStacked
*,vtkDataArray *,vtkDataArray *,vtkPlotStackedSegment *)
- Have to help properly cast the vtkPoints2D - for example, changed
CopyToPointsSwitch(this->Points,this->Previous
? this->Previous->Points : 0,
                                 static_cast<VTK_TT*>(x_array->GetVoidPointer(0)),
                                 y_array,x_array->GetNumberOfTuples()));
to
CopyToPointsSwitch(this->Points,this->Previous
? vtkPoints2D::SafeDownCast(this->Previous->Points) : 0,
                                 static_cast<VTK_TT*>(x_array->GetVoidPointer(0)),
                                 y_array,x_array->GetNumberOfTuples()));
 
 
In linking CXX executable in
Filtering\Testing\Cxx\CMakeFiles\FilteringCxxTests.exe
Unresolved external
'_vtk_netcdf_nc_inq_varid' (and several others related to netcdf) referenced
from vtkSLACReader and elsewhere.
 - When watching closely, during build of
vtkNetCDF.lib, the compiler provides a warning that dim.c.obj and var.c.obj are
duplicate filenames (because files of the same name are present both in
vtkNetCDF.dir\libsrc and vtkNetCDF.dir\libdispatch) and will therefore not be
added again.  Although filenames are the
same, contents are different, with the unresolved classes residing in the
\libdispatch versions.  Renamed dim.c.obj
to dim2.c.obj and var.c.obj to var2.c.obj in the libdispatch directory and changed lines
within build.make in C:\VTK510\VTK510Bin\Utilities\vtknetcdf\CMakeFiles\vtkNetCDF.dir
to reflect the renamed obj files.




More information about the vtkusers mailing list