[vtkusers] VTK with visual Studio 2005

Amy Squillacote amylists at gmail.com
Tue Dec 5 09:12:31 EST 2006


Hi Oleg,

For some VTK simple examples that use CMakeLists.txt files, look in the 
VTK/Examples directory. Several of the directories there contain Cxx 
subdirectories with VTK C++ examples (e.g., 
VTK/Examples/DataManipulation/Cxx/).

- Amy

Yianis Nikolaou wrote:
> hi oleg,
>
> I believe the easiest way to use VTK is by creating your projects 
> using CMake, like you did with the VTK source. Creating CMakeList.txt 
> files for your own projects is quite easy, I hope the following 
> example helps:
>
> PROJECT (your_Project_name)
>  
> #############
> #vtk section
> #############
> INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
> IF (USE_VTK_FILE)
>   INCLUDE(${USE_VTK_FILE})
> ENDIF (USE_VTK_FILE)
>
> #################################
> #MFC section, if you are using MFC
> #################################
> ADD_DEFINITIONS(-D_AFXDLL)
> SET(CMAKE_MFC_FLAG 2)
>
>
> ADD_EXECUTABLE(your_Project_name WIN32
> #your source files go here
> #your_Project_name.cpp
> #your_Project_name.h
> #etc
> #etc
> )
>
>
> TARGET_LINK_LIBRARIES(your_Project_name
>   vtkRendering
>   vtkGraphics
>   vtkIO
>   vtkFiltering
>   vtkCommon
>   vtkWidgets
> )
>
> Save the above lines as CMakelist.txt in your directory and modify it 
> according to your needs. You should modify the link libraries section 
> if you want to use other features of VTK, but i think these libraries 
> will cover your initial tests. Then run CMake as you did when you 
> created the VTK project.
>
> hope this helps,
> yianis
>
>
> On 12/4/06, *Oleg Pianykh* <opiany at gmail.com 
> <mailto:opiany at gmail.com>> wrote:
>
>     I downloaded VTK and run CMake 2.4 to build the .sln file for my
>     Visual Studio.
>     Then I was able to compile VTK with Visual Studio, worked fine.
>      
>     Now I'd like to test some sample VTL code, or write mine, BUT
>     1. Which VTK .h files should I include, with which static .lib VTK
>     libraries? I do not see any single VTK include folder or file - do
>     I do this by trial and error?
>     2. As soon as I add something like
>
>     #include "vtkConeSource.h"
>
>     to my program, I immediately get an error message from the Visual
>     Studio compiler about
>
>     #cmakedefine
>
>     being an illegal preprocessor directive. Did I do something wrong
>     with CMake (I changes a few settings there, following instructions
>     from one VTK posting about CMake that I found online)? If I
>     replace #cmakedefine with #define in vtkConfig.h file, this error
>     message disappears, but i get an avalanche of other errors.
>
>     What am I doing wrong, and what is the simplest way to run at
>     least one VTK sample source code to get started?
>
>
>     _______________________________________________
>     This is the private VTK discussion list.
>     Please keep messages on-topic. Check the FAQ at:
>     http://www.vtk.org/Wiki/VTK_FAQ
>     Follow this link to subscribe/unsubscribe:
>     http://www.vtk.org/mailman/listinfo/vtkusers
>     <http://www.vtk.org/mailman/listinfo/vtkusers>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   



More information about the vtkusers mailing list