[vtkusers] Odd linking errors when using the IO library with C++

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Sep 24 11:06:20 EDT 2004


Morten,

	Are you using cmake? If so:

FIND_PACKAGE(VTK)
IF (VTK_FOUND)
   INCLUDE (${VTK_USE_FILE})
ENDIF (VTK_FOUND)
 

ADD_EXECUTABLE(tiff tiff.cxx )
TARGET_LINK_LIBRARIES (tiff
   vtkIO
)

HTH
Mathieu



Morten Stakkeland wrote:
> Thanks. Pretty easy when you know how to do it ;-D
> 
> Morten
> 
> On Fri, 24 Sep 2004, Mathieu Malaterre wrote:
> 
> 
>>Morten,
>>
>>	You need to link your exe to vtkIO.
>>
>>HTH
>>Mathieu
>>
>>Morten Stakkeland wrote:
>>
>>>Hi,
>>>
>>>I am trying to set up VTK 4.2 in a cygwin environment in windows XP (for
>>>the first time). Everything seems to work perfectly, except when I try
>>>importing any class from the IO-library. For instance when trying to
>>>compile the following code:
>>>
>>>#include<vtkTIFFReader.h>
>>>int main()
>>>{
>>>    vtkTIFFReader* test=vtkTIFFReader::New();
>>>}
>>>
>>>I get the following output:
>>>
>>>$ make
>>>Building dependencies cmake.check_depends...
>>>-- Loading VTK CMake commands
>>>-- Loading VTK CMake commands - done
>>>Building object file MarFrame.o...
>>>Building executable /cygdrive/p/visual/mar_envir/MarFrame.exe...
>>>MarFrame.o(.text+0x1f):MarFrame.cpp: undefined reference to
>>>`__imp___ZN13vtkTIFFReader3NewEv'
>>>collect2: ld returned 1 exit status
>>>make[1]: *** [/cygdrive/p/visual/mar_envir/MarFrame.exe] Error 1
>>>make: *** [default_target] Error 2
>>>
>>>The same linking error appears whenever I try to instantiate a class from
>>>the IO library. Any help would be appreciated...
>>>
>>>
>>>Regards,
>>>Morten
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
>>
>>
>>
> 






More information about the vtkusers mailing list