[vtkusers] Segmentation fault when trying to export a vtk mesh
Luc Valade
lucj.valade at gmail.com
Thu May 21 09:35:44 EDT 2015
The debugger stops here:
0 libstdc++-6!_ZNSt6localeaSERKS_
1 libstdc++-6!_ZNSt8ios_base7_M_initEv
2
libstdc++-6!_ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E
3 vtkXMLWriter::OpenFile()
4 vtkXMLWriter::OpenStream()
5 vtkXMLUnstructuredDataWriter::ProcessRequest(vtkInformation*,
vtkInformationVector**, vtkInformationVector*)
6 vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**,
vtkInformationVector*)
7 vtkDemandDrivenPipeline::ExecuteData(vtkInformation*,
vtkInformationVector**, vtkInformationVector*)
8 vtkCompositeDataPipeline::ExecuteData(vtkInformation*,
vtkInformationVector**, vtkInformationVector*)
9 vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*,
vtkInformationVector**, vtkInformationVector*)
10 vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*,
vtkInformationVector**, vtkInformationVector*)
11 vtkDemandDrivenPipeline::UpdateData(int)
12 vtkStreamingDemandDrivenPipeline::Update(int)
13 vtkAlgorithm::Update()
14 vtkXMLWriter::Write()
15 main main.cpp
2015-05-21 15:26 GMT+02:00 Cory Quammen <cory.quammen at kitware.com>:
> Luc,
>
> Sorry, I didn't see that. I don't see anything else that is obvious. I
> suggest compiling in debug mode and running it through a debugger to
> see where it is crashing.
>
> Cory
>
> On Thu, May 21, 2015 at 8:09 AM, Luc Valade <lucj.valade at gmail.com> wrote:
> > Hi Cory
> >
> > I already calls writer->SetFileName("test.vtp"). I also prints
> > "writer->GetFileName()" into console to check, and there is no problem
> here.
> >
> > Luc
> >
> >
> > 2015-05-21 13:48 GMT+02:00 Cory Quammen <cory.quammen at kitware.com>:
> >>
> >> You haven't called writer->SetFileName() to specify where the file
> >> should be saved. That is necessary and may fix your crash - though
> >> there should be a more graceful approach to handling an empty file
> >> name than crashing, so that may not be it.
> >>
> >> HTH,
> >> Cory
> >>
> >> On Thu, May 21, 2015 at 3:34 AM, Luc Valade <lucj.valade at gmail.com>
> wrote:
> >> > Hi,
> >> >
> >> >
> >> >
> >> > I have a problem with the export of vtk meshes using vtkXMLWriter
> class.
> >> > Indeed, my project builds without any problem, but during the run, the
> >> > call
> >> > of the vtkXMLWriter method Write() generates a segmentation fault.
> >> >
> >> >
> >> >
> >> > I works on Windows and uses qtcreator and qmake. I uses the version
> 6.2
> >> > of
> >> > vtk. I've already build tutorial vtk projects using qmake to learn how
> >> > to
> >> > well linked projects to vtk dlls, and it worked well.
> >> >
> >> >
> >> >
> >> > Here is the projet I tried to run without success (.pro and main.cpp
> >> > file)
> >> >
> >> >
> >> >
> >> > TEMPLATE = app
> >> >
> >> >
> >> >
> >> > CONFIG += console
> >> >
> >> > CONFIG -= app_bundle
> >> >
> >> > CONFIG -= qt
> >> >
> >> >
> >> >
> >> > SOURCES += main.cpp
> >> >
> >> >
> >> >
> >> > INCLUDEPATH += "C:\Program Files (x86)\VTK\include\vtk-6.2"
> >> >
> >> > LIBS += "-LC:\Program Files (x86)\VTK\lib"
> >> >
> >> > LIBS += -lvtkCommonDataModel-6.2.dll \
> >> >
> >> > -lvtkCommonCore-6.2.dll \
> >> >
> >> > -lvtkIOXML-6.2.dll
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > #include <vtkVersion.h>
> >> >
> >> > #include <vtkCellArray.h>
> >> >
> >> > #include <vtkPoints.h>
> >> >
> >> > #include <vtkXMLPolyDataWriter.h>
> >> >
> >> > #include <vtkPolyData.h>
> >> >
> >> > #include <vtkSmartPointer.h>
> >> >
> >> >
> >> >
> >> > int main ( int, char *[] )
> >> >
> >> > {
> >> >
> >> > // Create 10 points.
> >> >
> >> > vtkSmartPointer<vtkPoints> points =
> >> >
> >> > vtkSmartPointer<vtkPoints>::New();
> >> >
> >> >
> >> >
> >> > for ( unsigned int i = 0; i < 10; ++i )
> >> >
> >> > {
> >> >
> >> > points->InsertNextPoint ( i, i, i );
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > // Create a polydata object and add the points to it.
> >> >
> >> > vtkSmartPointer<vtkPolyData> polydata =
> >> >
> >> > vtkSmartPointer<vtkPolyData>::New();
> >> >
> >> > polydata->SetPoints(points);
> >> >
> >> >
> >> >
> >> > // Write the file
> >> >
> >> > vtkSmartPointer<vtkXMLPolyDataWriter> writer =
> >> >
> >> > vtkSmartPointer<vtkXMLPolyDataWriter>::New();
> >> >
> >> > writer->SetFileName("test.vtp");
> >> >
> >> > #if VTK_MAJOR_VERSION <= 5
> >> >
> >> > writer->SetInput(polydata);
> >> >
> >> > #else
> >> >
> >> > writer->SetInputData(polydata);
> >> >
> >> > #endif
> >> >
> >> >
> >> >
> >> > // Optional - set the mode. The default is binary.
> >> >
> >> > //writer->SetDataModeToBinary();
> >> >
> >> > //writer->SetDataModeToAscii();
> >> >
> >> >
> >> >
> >> > writer->Write();
> >> >
> >> >
> >> >
> >> > return EXIT_SUCCESS;
> >> >
> >> > }
> >> >
> >> >
> >> > Thanks in advance for any help.
> >> >
> >> >
> >> > _______________________________________________
> >> > Powered by www.kitware.com
> >> >
> >> > Visit other Kitware open-source projects at
> >> > http://www.kitware.com/opensource/opensource.html
> >> >
> >> > Please keep messages on-topic and check the VTK FAQ at:
> >> > http://www.vtk.org/Wiki/VTK_FAQ
> >> >
> >> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >> >
> >> > Follow this link to subscribe/unsubscribe:
> >> > http://public.kitware.com/mailman/listinfo/vtkusers
> >> >
> >>
> >>
> >>
> >> --
> >> Cory Quammen
> >> R&D Engineer
> >> Kitware, Inc.
> >
> >
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150521/c790e1d6/attachment.html>
More information about the vtkusers
mailing list