About vtkCellArray::InsertNextCell()

Why undefined error?

line->GetPointIds()->SetId(0, 0);
line->GetPointIds()->SetId(0, 1);
vtkNew<vtkCellArray> cells;
cells->InsertNextCell(line);

build information: vtk-9.1 with MinGW8.1 

Here is the compile error infomation:
CMakeFiles/LearnVtk.dir/main.cpp.obj: In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<int>, int>::SetValue(long long, int)':

CMakeFiles/LearnVtk.dir/main.cpp.obj: In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<long long>, long long>::SetValue(long long, long long)':

Could you display the full error for each instance? The error ends with a column, which seems to indicate there’s more to it. In the meantime, can you try:

#include <vtkTypeInt64Array.h>
#include <vtkTypeInt32Array.h>

Hi, Thanks for your reply. I’m using example in this page:

https://kitware.github.io/vtk-examples/site/Cxx/GeometricObjects/ColoredLines/

other examples without this function works fine.

I’ve tried include headers suggested, but still not work, here is the full error information:

FAILED: LearnVtk.exe 
cmd.exe /C "cd . && D:\Dev\Qt\Qt5.15.2\Tools\mingw810_64\bin\g++.exe -g  @CMakeFiles\LearnVtk.rsp -o LearnVtk.exe -Wl,--out-implib,libLearnVtk.dll.a -Wl,--major-image-version,0,--minor-image-version,0  && cd ."
CMakeFiles/LearnVtk.dir/main.cpp.obj: In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<long long>, long long>::SetValue(long long, long long)':
D:/Dev/VTK/include/vtk-9.1/vtkGenericDataArray.h:122: undefined reference to `vtkAOSDataArrayTemplate<long long>::SetValue(long long, long long)'
CMakeFiles/LearnVtk.dir/main.cpp.obj: In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<int>, int>::SetValue(long long, int)':
D:/Dev/VTK/include/vtk-9.1/vtkGenericDataArray.h:122: undefined reference to `vtkAOSDataArrayTemplate<int>::SetValue(long long, int)'
CMakeFiles/LearnVtk.dir/main.cpp.obj: In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<unsigned char>, unsigned char>::SetTypedTuple(long long, unsigned char const*)':
D:/Dev/VTK/include/vtk-9.1/vtkGenericDataArray.h:150: undefined reference to `vtkAOSDataArrayTemplate<unsigned char>::SetTypedTuple(long long, unsigned char const*)'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
21:55:48: Process "D:\Dev\Qt\Qt5.15.2\Tools\CMake_64\bin\cmake.exe"Exit,退exit code 1 。
Error while building/deploying project LearnVtk (kit: Desktop Qt 5.15.2 MinGW 64-bit)
When executing step "Build"
21:55:48: Elapsed time: 00:00.

It solved compiled with MSVC. Seems compiler issue