[vtkusers] Re: Linker problems
Rhys Thomas
rgt at informatics.bangor.ac.uk
Wed Jan 11 04:22:10 EST 2006
Thanks for all of the replies, they were most helpful. It turns out that
I had added the relevant directories to the directories thing, but I
hadn't added the libraries to the linker settings.
Rhys
Paul Tait - OPES wrote:
> Its VC6 centric but this works for me
>
> Include it in a .cpp file and adjust paths to taste
>
> #ifdef _DEBUG
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkCommon.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkFiltering.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkGraphics.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkImaging.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkIO.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkRendering.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkFreeType.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkftgl.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/Debug/vtkHybrid.lib")
> #else
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkCommon.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkFiltering.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkGraphics.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkImaging.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkIO.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkRendering.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkFreeType.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkftgl.lib")
> #pragma comment(lib, "C:/vtk/vtkbin/bin/RelWithDebInfo/vtkHybrid.lib")
> #endif
>
> -----Original Message-----
> From: vtkusers-bounces+paul=opes.com.au at vtk.org
> [mailto:vtkusers-bounces+paul=opes.com.au at vtk.org] On Behalf Of Goodwin
> Lawlor
> Sent: Tuesday, 10 January 2006 2:44 AM
> To: vtkusers at public.kitware.com
> Subject: [vtkusers] Re: Linker problems
>
>
> Hi Rhys,
>
> There's 3 things to check
>
> 1. That the vtkIO.lib has been added to the linker input box. 2. That the
> folder where vtkIO.lib resides is listed as a linker directory 3. That
> vtkIO.lib has been built correctly and exports the
> vtkStructuredPointsReader object.
>
> Why not use cmake to correctly set up your VC++ project for you? Create
> a file CMakeLists.txt (in the same folder as you source file) with this
> text:
>
> PROJECT (test_project)
>
> 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(test_project test_project.cxx)
> TARGET_LINK_LIBRARIES(test_project vtkRendering vtkIO)
>
> and now run cmake
>
> hth
>
> Goodwin
>
>
>
> Rhys Thomas wrote:
>
>> Hello one and all, I would very much appreciate it if somebody could
>> help me with the following problem. When I attempt to build the
>> following program in Microsoft Visual Studio 6 I get back error messages
>> from the linker complaining of an unresolved external symbol, however I
>> believe that I have set the linker to link to all of the necessary code.
>>
>> My code is thus:
>>
>> #include "vtkActor.h"
>> #include "vtkRenderer.h"
>> #include "vtkRenderWindow.h"
>> #include "vtkStructuredPoints.h"
>> #include "vtkStructuredPointsReader.h"
>>
>> int main(int argc, char**argv)
>> {
>> vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();
>> reader->SetFileName("c:/abdomen.vtk");
>> reader->Delete();
>> return 0;
>> }
>>
>> and produces the following output when a build attempt is made:
>>
>> --------------------Configuration: RenderData - Win32
>> Debug--------------------
>> Linking...
>> RenderData.obj : error LNK2001: unresolved external symbol "public:
>> static class vtkStructuredPointsReader * __cdecl
>> vtkStructuredPointsReader::New(void)"
>> (?New at vtkStructuredPointsReader@@SAPAV1 at XZ)
>> Debug/RenderData.exe : fatal error LNK1120: 1 unresolved externals
>> Error executing link.exe.
>>
>> RenderData.exe - 2 error(s), 0 warning(s)
>>
>> Thanks for your time
>>
>> Rhys Thomas
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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