<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Bob,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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 : <a href="http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/3f2869ca-2c07-49a8-a443-52720b10ea09/">http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/3f2869ca-2c07-49a8-a443-52720b10ea09/</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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 ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Else I am lost here too.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Daniel<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Bob Palank [mailto:bob@stlcc.org] <br><b>Gesendet:</b> Mittwoch, 25. Mai 2011 20:22<br><b>An:</b> Frese Daniel Dr.<br><b>Betreff:</b> Re: [vtkusers] Using VTK in a Visual C++ project Express 2010<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Dr. Frese,<br><br>I, unlike you, have had no success !<br>My main code follows:</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>int main(array<System::String ^> ^args)</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>{</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>// create sphere geometry</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>// App runs with the line below commented out</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Console::WriteLine(L"Pre vtkSmartPointer stmt");</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Console::ReadLine();</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Console::WriteLine(L"Post vtkSmartPointer stmt");</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Console::ReadLine();</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>return 0;</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>}</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> I do get a clean build and execute console statements as expected if I remove the one vtk statement.<br>When I add it, I still get a clean build but execution fails before the Console::ReadLine(); executes.<br>with the following error:</span><o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>LDR: LdrpWalkImportDescriptor() failed to probe C:\WINDOWS\system32\vtkCommon.dll for its manifest, ntstatus 0xc0150002</span><o:p></o:p></p></div><div><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Debugger:: An unhandled non-continuable exception was thrown during process load</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>The program '[1160] Freese01.exe: Native' has exited with code -1072365566 (0xc0150002).</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>===================================================================</span><o:p></o:p></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Any thoughts ?<br> Bob Palank</span><o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>----- Original Message ----- </span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>From: "Frese Daniel Dr." <</span><a href="mailto:frese@heidenhain.de"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>frese@heidenhain.de</span></a><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>></span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>To: "Bob Palank" <</span><a href="mailto:bob@stlcc.org"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>bob@stlcc.org</span></a><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>>; <</span><a href="mailto:vtkusers@vtk.org"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>vtkusers@vtk.org</span></a><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>></span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Sent: Monday, April 18, 2011 9:23 AM</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Subject: AW: [vtkusers] Using VTK in a Visual C++ project Express 2010</span><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>> Hi Bob,<br>> <br>> Yes, this should be possible. I tried it, although with the VS 2005 professional edition.<br>> Here is a small sample program:<br>> <br>> // clr_console.cpp : main project file.<br>> <br>> #include "stdafx.h"<br>> <br>> #include <vtkSmartPointer.h><br>> #include <vtkSphereSource.h><br>> #include <vtkPolyDataMapper.h><br>> #include <vtkActor.h><br>> #include <vtkRenderer.h><br>> #include <vtkWin32OpenGLRenderWindow.h><br>> #include <vtkWin32RenderWindowInteractor.h><br>> <br>> <br>> using namespace System;<br>> <br>> int main(array<System::String ^> ^args)<br>> {<br>> // create sphere geometry<br>> vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();<br>> <br>> // map to graphics library<br>> vtkSmartPointer<vtkPolyDataMapper> map = vtkSmartPointer<vtkPolyDataMapper>::New();<br>> map->SetInputConnection(sphere->GetOutputPort());<br>> <br>> // actor coordinates geometry, properties, transformation<br>> vtkSmartPointer<vtkActor> aSphere = vtkSmartPointer<vtkActor>::New();<br>> aSphere->SetMapper(map);<br>> <br>> // a renderer and render window<br>> vtkSmartPointer<vtkRenderer> Renderer = vtkSmartPointer<vtkRenderer>::New();<br>> vtkSmartPointer<vtkWin32OpenGLRenderWindow> RenderWindow = vtkSmartPointer<vtkWin32OpenGLRenderWindow>::New();<br>> RenderWindow->AddRenderer(Renderer);<br>> <br>> <br>> // add the actor to the scene and define Interactor<br>> vtkSmartPointer<vtkWin32RenderWindowInteractor> Interactor = vtkSmartPointer<vtkWin32RenderWindowInteractor>::New();<br>> Interactor->SetRenderWindow(RenderWindow);<br>> Renderer->AddActor(aSphere);<br>> <br>> // start to play around<br>> RenderWindow->Render();<br>> Interactor->Initialize();<br>> Interactor->Start();<br>> }<br>> <br>> To build and execute this one, I had to do the following:<br>> 1) new project of type clr console application; paste the above code into the new cpp file.<br>> 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")<br>> 3) Add Lib dir projects->properties->Linker->Additional Library Directories (in my case this is "C:\Programme\VTK\lib\vtk-5.9")<br>> 4) Add necessary vtk libs under projects->properties->Linker->Additional Dependencies (in my case the entry is <br>> "Opengl32.lib Gdi32.lib User32.lib vtkFiltering.lib vtkCommon.lib vtkGraphics.lib vtkRendering.lib $(NoInherit)"; not sure if everything<br>> here is necessary, but it works).<br>> <br>> 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.<br>> <br>> Daniel<br>> <br>> <br>> -----Ursprüngliche Nachricht-----<br>> Von: </span><a href="mailto:vtkusers-bounces@vtk.org"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>vtkusers-bounces@vtk.org</span></a><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> [mailto:vtkusers-bounces@vtk.org] Im Auftrag von Bob Palank<br>> Gesendet: Sonntag, 17. April 2011 17:42<br>> An: </span><a href="mailto:vtkusers@vtk.org"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>vtkusers@vtk.org</span></a><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>> Betreff: Re: [vtkusers] Using VTK in a Visual C++ project Express 2010<br>> <br>> Can I run a vtk application using the clr console application template in<br>> VC++ Express 2010 ?<br>> Bob<br>> -------------------------------------------------------------------------------------------------------<br>> Registergericht: Traunstein / Registry Court: HRB 275 – Sitz / Head Office: Traunreut<br>> Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard<br>> Geschäftsführung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),<br>> Michael Grimm, Matthias Fauser, Sebastian Tondorf<br>> <br>> E-Mail Haftungsausschluss / E-Mail Disclaimer: </span><a href="http://www.heidenhain.de/disclaimer"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>http://www.heidenhain.de/disclaimer</span></a><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>> <br>></span><o:p></o:p></p></div></body></html>