[vtkusers] Unable to link agains VTK

David Doria daviddoria at gmail.com
Thu Nov 15 08:13:46 EST 2012


On Thu, Nov 15, 2012 at 3:51 AM, alex88 <alex88 at correo.ugr.es> wrote:

> Hi,
>
> Im starting to use VTK in a project. Im working in Windows, using
> Code::Blocks with Mingw.
> I built VTK and installed it with no problems.
>
> In my project, I added the include folder to the search directories, and
> linked against all the static libraries generated with the instalation (the
> ones in VTK/lib, wich I added as a library directory), but when I compile,
> it finds all the includes, but throws VTK related linking errors.
>
> Why could be the problem?
>
> Thanx you :)
>
> Alex
>

It is strongly, strongly suggested that you use CMake to generate your
project. It will handle all of the include paths, linker paths, and linked
libraries for you automatically. Just use something like this, where here
we are building a project called "Sphere" and the only source file is
Sphere.cxx.

cmake_minimum_required(VERSION 2.8)
 PROJECT(Sphere)
 find_package(VTK REQUIRED)include(${VTK_USE_FILE})
 add_executable(Sphere Sphere.cxx)target_link_libraries(Sphere ${VTK_LIBRARIES})


David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121115/b4520db3/attachment.htm>


More information about the vtkusers mailing list