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

Frese Daniel Dr. frese at heidenhain.de
Thu Apr 14 03:09:59 EDT 2011


Hi,

since I had similar problems (I also develop using the Microsoft Visual Studio on Windows), and work  with vtk for a few months by now, I'd also like to briefly comment on this.
I do believe that CMake is an extremely useful tool, and at several occasions I was very happy when I downloaded some open source stuff and discovered that there was some CMakeLists.txt with it. It makes live much easier, when you have an automated way of generating a functional code base.

But to be honest, I never was really anxious to set up my own projects using it. There is a tendency among open source, that many projects use their own building system (although CMake plays a dominant role here - I read even KDE can be compiled using CMake nowadays). Which certainly makes sense for the developers of the specific software package, since they can use a system adapted to their needs.
Right now for example I have to deal with the boost building system bjam, some UNIX makefile formats that I have to "translate" into .sln files, CMake and of course my native Visual Studio environment. I don't complain - I am happy that this software exists in the first place - but each system has its own learning curve. I simply do not want to spend time learning these build systems to such an extent as to use them by myself, if I can avoid it. Plus, using the Visual Studio platform on Windows, the solution/project system just happens to be the natural choice in my case. I guess it depends largely, on how large the percentage each code component is. In my case vtk is a conceptually important part of it, but the main parts of my code base concentrate on other stuff.
So this is just to imply, that there are situations, where not using CMake might also makes sense (at least after the vtk bins have been built - using CMake of course).

To go back to the specific problem, for building some graphics within the .net environment (don't know, if this what you are after), I found the following link very helpful : http://se.xzing.org/2006/09/29/using-vtk-in-net-application-part-i/

Also, another hint, I got sometimes the same amount of error messages if the Visual Studio settings for CLI were set wrongly (in my VS2008 : project properties -> Configuration Properties -> General -> Common Language Runtime support). For using vtk, make sure you have selected "now common language runtime support" (if you don't use managed components) or at least /clr (if you mix managed and unmanaged components), but not something like /clr:pure which is for some projects the standard setting.

Daniel


Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im Auftrag von David Doria
Gesendet: Mittwoch, 13. April 2011 18:23
An: KK
Cc: vtkusers at vtk.org
Betreff: Re: [vtkusers] Using VTK in a Visual C++ project

On Wed, Apr 13, 2011 at 12:19 PM, KK <karoll.frindel at gmail.com<mailto:karoll.frindel at gmail.com>> wrote:
It's what I did. I used CMake to get a VTK.sln (VS project).
But now I'm trying to use the binaries resulting from the compilation of
VTK.sln to use VTK in my own VS project (integrate the VTK libs in my
project dependencies).

Yes, again you must use CMake.

As an example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Sphere

the CMakeLists.txt file there creates a Sphere.sln that you then open with VS and everything is automatically configured.

David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110414/36bc882c/attachment.htm>
-------------- next part --------------
</PRE><p>
------------------------------------------------------------------------------------------------------ <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>
<a href="http://www.heidenhain.de/disclaimer" target="_blank">E-Mail Haftungsausschluss / E-Mail Disclaimer</a><br><pre>


More information about the vtkusers mailing list