[vtkusers] Problems with VS 2005 and VTK (vtkrendering.lib)

Ning Ye aboycn at gmail.com
Wed Nov 1 22:16:32 EST 2006


Obada is right, don't give up VTK. It's really a cool stuff.
Actually, you CAN use VTK in VC++ .NET 2005 for your own project without
CMake.
Here's my step in great detail:
-------- Build and install VTK, CMake is needed here for only once --------
1. Extract VTK source code to a directory, say, D:\Programming\VTK\vtk-
5.0.2\src
2. Make another directory for build, say, D:\Programming\VTK\vtk-5.0.2\build
3. Run CMake and configure it as shown in the picture attached, press OK
4. Enter the build directory, D:\Programming\VTK\vtk-5.0.2\build, open the
solution file VTK.sln
5. Set the solution configuration to Debug mode, right click ALL_BUILD,
build
6. Right click INSTALL, build
7. Enter the install directory, for me, it's C:\Program Files\VTK
8. Enter the sub-directory for library, i.e., C:\Program Files\VTK\lib, for
now, all the .lib files here are built under Debug, you can use them for
Debug in your own project
9. So, make a new directory here, say, C:\Program Files\VTK\lib\debug, and
move all the .lib files into it
10. Back to VC++, this time, set your solution configuration to Release mode
and redo step 5 and 6
11. Enter C:\Program Files\VTK\lib again, now, all the .lib files are built
under Release, you can use them for Release in your own project
12. So, make another new directory here, say, C:\Program
Files\VTK\lib\release, and move all the .lib files into it
13. Installation part is done.
--------Configuration for your own project--------
1. Configure VC++ INCLUDE path: Tools->Options->Projects and Solutions->VC++
Directories->Include files, add the VTK include directory into the list, for
me, it's C:\Program Files\VTK\include
2. Configure your project property:
Debug mode:
- set Configuration Properties->Linker->General->Additional Library
Directories as C:\Program Files\VTK\lib\debug
- set Configuration Properties->Linker->Input->Additional Dependencies as
all the .lib files you need, well, you can just include all the library
files here to make it work for sure
Release mode:
- set Configuration Properties->Linker->General->Additional Library
Directories as C:\Program Files\VTK\lib\release
- set Configuration Properties->Linker->Input->Additional Dependencies as
all the .lib files you need, again, you can just include all the library
files here to make it work for sure
3. Done.

Compile and build your projects as you want.
Happy programming!


On 11/2/06, mam06bhv at studserv.uni-leipzig.de <
mam06bhv at studserv.uni-leipzig.de> wrote:
>
> Obada Mahdi schrieb:
> > Hi Markus!
> >
> > On 11/1/06, mam06bhv <mam06bhv at studserv.uni-leipzig.de> wrote:
> >> I've solved the problem but now I got these errors in the VTK-window
> >
> > Just for the record, what was the solution?  It might be helpful to
> > others who search the mailing list and find themselves having a
> > similar problem.
> >
> >> ERROR: In ..\..\VTK\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 824
> >> vtkWin32OpenGLRenderWindow (01970FD0): wglCreateContext failed in
> >> CreateAWindow(), error: 1114
> >>
> >> ERROR: In ..\..\VTK\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 824
> >> vtkWin32OpenGLRenderWindow (01970FD0): wglCreateContext failed in
> >> CreateAWindow(), error: 0
> >>
> >> ERROR: In ..\..\VTK\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 824
> >> vtkWin32OpenGLRenderWindow (01970FD0): wglCreateContext failed in
> >> CreateAWindow(), error: 6
> >
> > I did a quick search in the mailing list archives for similar error
> > messages and found a reply from Mathieu Malaterre:
> > http://public.kitware.com/pipermail/vtkusers/2004-January/071401.html
> >
> > Some other postings did not have replies or solutions, but it seems
> > that the problem is related to OpenGL drivers/libraries rather than
> > VTK.  One suggestion for narrowing down the problem is to run other
> > OpenGL applications and see if they work.  For example, start by
> > building VTK with "BUILD_EXAMPLES" set to "ON" and run one of the
> > examples, like "Cone".  If it does not work, try other, non-VTK
> > programs that use OpenGL, and if they do not work either, it is very
> > likely a problem with your graphics card/OpenGL driver.
> >
> > I also agree with Prename that you should consider using CMake for
> > creating your VisualStudio project.  After seeing the same problems
> > reportet on the mailing like multiple times, I do not think that this
> > will make a difference--but the important point is that it is much
> > easier to understand the steps involved in building your project and
> > to eliminate some possibilities that might be a result of an
> > unconventional build setup.
> >
> > Here is a sample "CMakeLists.txt" file that should be sufficient for
> > creating a VS8 Solution for your sample program (I called it
> > "markus-test.cc") using CMake:
> >
> > [this is actually a stripped-down version of
> > "Examples/Medical/Cxx/CMakeLists.txt"]
> > ----BEGIN----
> > PROJECT (markus-test)
> >
> > FIND_PACKAGE(VTK REQUIRED)
> > IF(NOT VTK_USE_RENDERING)
> >  MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires
> VTK_USE_RENDERING.")
> > ENDIF(NOT VTK_USE_RENDERING)
> > INCLUDE(${VTK_USE_FILE})
> >
> > ADD_EXECUTABLE(markus-test markus-test.cc)
> >
> > TARGET_LINK_LIBRARIES(markus-test vtkRendering)
> > ----END----
> >
> > Just put this and "markus-test.cc" into the same directory, create a
> > build directory somewhere and use CMakeSetup.exe to create a VS8
> > Solution file.  In the interactive configuratio process, you will need
> > to specify the location of the directory ".../lib/vtk-<version>" from
> > your VTK installation.
> >
> >
> > Regards
> >
> > Obada
> Sorry guys
> I'm tired to run it again and again. Is somewhere a tutorial or something
> else
> where I can go through step by step (downloading what installing where
> what to
> build wehre to copy and everything in detail) and not only telling me the
> half.
> in the last 3 days I've installed Cmake and VTK deinstalled everything.
> installed again and so one and nothing helped.
> Why should I use CMAKE to complie when I have Visual Studio where I create
> my
> projects? If I can use vtk only with Cmake I know why I've never heard
> before
> of it.
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061102/9fc05682/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_vtk.GIF
Type: image/gif
Size: 24131 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061102/9fc05682/attachment.gif>


More information about the vtkusers mailing list