[vtkusers] Using VTK in a Visual C++ project Express 2010

Frese Daniel Dr. frese at heidenhain.de
Thu May 26 08:51:39 EDT 2011


Hi Bob,

this feels like a more general MSVC problem within your setup. I made a small project with your code and it works as expected for me; for reference I included a zip of my solution folder (I originally did this in MSVC 2008, then noticed you use 2010 and converted the solution to the 2010 format. Both worked for me). You might have to adjust the include/lib paths when you try it on your box.

I am really no expert for these strange error messages. I googled a bit using your error messages and came up with several hits, so this seems to be a more common problem. I found the following discussion kind of close to your description : http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/3f2869ca-2c07-49a8-a443-52720b10ea09/
I don’t want to pretend that I understand much of their discussion, but it seems to me that these problems are more likely to appear if the vtk libraries and your exe are built with different versions of the MSVC. So did you built your vtk by yourself (this is the case for me)  or did you download a binary distribution ?

Else I am lost here too.

Daniel

Von: Bob Palank [mailto:bob at stlcc.org]
Gesendet: Mittwoch, 25. Mai 2011 20:22
An: Frese Daniel Dr.
Betreff: Re: [vtkusers] Using VTK in a Visual C++ project Express 2010

Dr. Frese,

I, unlike you, have had  no success !
My main code follows:

int main(array<System::String ^> ^args)

{

// create sphere geometry

// App runs with the line below commented out

Console::WriteLine(L"Pre vtkSmartPointer stmt");

Console::ReadLine();

vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();

Console::WriteLine(L"Post vtkSmartPointer stmt");

Console::ReadLine();

return 0;

}
 I do get a clean build and execute console statements as expected if I remove the one vtk statement.
When I add it, I still get a clean build but execution fails before the Console::ReadLine(); executes.
with the following error:

LDR: LdrpWalkImportDescriptor() failed to probe C:\WINDOWS\system32\vtkCommon.dll for its manifest, ntstatus 0xc0150002

Debugger:: An unhandled non-continuable exception was thrown during process load

The program '[1160] Freese01.exe: Native' has exited with code -1072365566 (0xc0150002).

===================================================================

Any thoughts ?
  Bob Palank






----- Original Message -----
From: "Frese Daniel Dr." <frese at heidenhain.de<mailto:frese at heidenhain.de>>
To: "Bob Palank" <bob at stlcc.org<mailto:bob at stlcc.org>>; <vtkusers at vtk.org<mailto:vtkusers at vtk.org>>
Sent: Monday, April 18, 2011 9:23 AM
Subject: AW: [vtkusers] Using VTK in a Visual C++ project Express 2010

> Hi Bob,
>
> Yes, this should be possible. I tried it, although with the VS 2005 professional edition.
> Here is a small sample program:
>
> // clr_console.cpp : main project file.
>
> #include "stdafx.h"
>
> #include <vtkSmartPointer.h>
> #include <vtkSphereSource.h>
> #include <vtkPolyDataMapper.h>
> #include <vtkActor.h>
> #include <vtkRenderer.h>
> #include <vtkWin32OpenGLRenderWindow.h>
> #include <vtkWin32RenderWindowInteractor.h>
>
>
> using namespace System;
>
> int main(array<System::String ^> ^args)
> {
> // create sphere geometry
>    vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
>
>    // map to graphics library
>    vtkSmartPointer<vtkPolyDataMapper> map = vtkSmartPointer<vtkPolyDataMapper>::New();
>    map->SetInputConnection(sphere->GetOutputPort());
>
>    // actor coordinates geometry, properties, transformation
>    vtkSmartPointer<vtkActor> aSphere = vtkSmartPointer<vtkActor>::New();
>    aSphere->SetMapper(map);
>
> // a renderer and render window
>    vtkSmartPointer<vtkRenderer> Renderer = vtkSmartPointer<vtkRenderer>::New();
>    vtkSmartPointer<vtkWin32OpenGLRenderWindow> RenderWindow = vtkSmartPointer<vtkWin32OpenGLRenderWindow>::New();
>    RenderWindow->AddRenderer(Renderer);
>
>
>    // add the actor to the scene and define Interactor
> vtkSmartPointer<vtkWin32RenderWindowInteractor> Interactor = vtkSmartPointer<vtkWin32RenderWindowInteractor>::New();
> Interactor->SetRenderWindow(RenderWindow);
>    Renderer->AddActor(aSphere);
>
> // start to play around
> RenderWindow->Render();
> Interactor->Initialize();
> Interactor->Start();
> }
>
> To build and execute this one, I had to do the following:
> 1) new project of type clr console application; paste the above code into the new cpp file.
> 2) Add Include dir under projects->properties->C/C++->General->Additional Include Directories (in my case this is "C:\Programme\VTK\include\vtk-5.9")
> 3) Add Lib dir projects->properties->Linker->Additional Library Directories (in my case this is "C:\Programme\VTK\lib\vtk-5.9")
> 4) Add necessary vtk libs under projects->properties->Linker->Additional Dependencies (in my case the entry is
> "Opengl32.lib Gdi32.lib User32.lib vtkFiltering.lib vtkCommon.lib vtkGraphics.lib vtkRendering.lib $(NoInherit)"; not sure if everything
> here is necessary, but it works).
>
> I do get an annoying linker warning " warning LNK4248: unresolved typeref token (01000015) for 'vtkAlgorithmOutput'; image may not run" (also on other projects I work on), but so far it has been OK to ignore this; everything runs fine.
>
> Daniel
>
>
> -----Ursprüngliche Nachricht-----
> Von: vtkusers-bounces at vtk.org<mailto:vtkusers-bounces at vtk.org> [mailto:vtkusers-bounces at vtk.org] Im Auftrag von Bob Palank
> Gesendet: Sonntag, 17. April 2011 17:42
> An: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
> Betreff: Re: [vtkusers] Using VTK in a Visual C++ project Express 2010
>
> Can I run a vtk application using the clr console application template in
> VC++ Express 2010 ?
> Bob
> -------------------------------------------------------------------------------------------------------
> Registergericht: Traunstein / Registry Court: HRB 275 – Sitz / Head Office: Traunreut
> Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard
> Geschäftsführung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),
> Michael Grimm, Matthias Fauser, Sebastian Tondorf
>
> E-Mail Haftungsausschluss / E-Mail Disclaimer: http://www.heidenhain.de/disclaimer
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110526/ffeb4998/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_sln.zip
Type: application/x-zip-compressed
Size: 10689 bytes
Desc: test_sln.zip
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110526/ffeb4998/attachment.bin>


More information about the vtkusers mailing list