[Insight-users] compiling VTK and ITK

Brad King brad.king at kitware.com
Mon, 26 Apr 2004 09:44:13 -0400


Sergio Andres wrote:
> 
> Hi all,
> 
> I am trying to compile my application using ITK 1.6 and VTK 4.2 ,
> but I get some link errors related to png and jpeg libraries...
> 
> The error messages are like these:
> 
> vtkpng.lib(png.obj) : error LNK2005: _png_pass_dsp_mask already defined 
> in itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_pass_mask already defined in 
> itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_pass_yinc already defined in 
> itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_pass_ystart already defined in 
> itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_pass_inc already defined in 
> itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_pass_start already defined in 
> itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_zTXt already defined in 
> itkpng.lib(png.obj)
> vtkpng.lib(png.obj) : error LNK2005: _png_tRNS already defined in 
> itkpng.lib(png.obj)
> 
> I suppose that they are conflicts between ITK and VTK ..
> but I don't know if I am doing things wrong..
> 
> Other messages are related to the following libraries: vtkzlib.lib, 
> itkvnl.lib, ITKIO.lib
> 
> Any help will be appreciated..

You are not doing anything wrong.  This is a problem with ITK 1.6 and 
VTK 4.2 if the IO libraries from both are linked into the same program. 
  They both provide their own copies of the png library.  This has been 
fixed in the CVS version of ITK and VTK by mangling the png library 
symbols to start with itk_ or vtk_ and avoid the conflict.

-Brad