[vtkusers] Unable to run a sample program
Magnus Elden
magnus_elden at hotmail.com
Wed Jul 27 12:20:02 EDT 2016
All you have to do is add the include and library folder + the libraries you
want to use.
In preferences->c/c++->general you can add the include path under additional
include directories.
Then, In preferences->linker->general add the library dir to the additional
library dependencies.
Finally, in preference->linker->input under additional dependencies you add
every library you want to link against.
So you have to list all folders that contain all the libraries AND you have
to name each library that you want to use. If either the name is not listed
or the path is not listed it will give you this error.
I would use Cmake instead though. Makes it much easier.
Yours,
Magnus Elden
-----Original Message-----
From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Cory Quammen
Sent: Wednesday, 27 July, 2016 17:27
To: Prajwal Sapare <prajwal.sapare at gmail.com>
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Unable to run a sample program
Prajwal,
I don't know the details of setting up include and library dependencies in
VS2013 so I can't help you there. Nor is there a tutorial for VS that I know
of.
Typically, developers who use VTK find it easiest to get things set up
properly by using CMake to generate the VS2013 files. See any of the example
CMakeLists.txt files in the VTK C++ wiki examples, e.g.,
http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/SimplePointsReader
If you don't want to use CMake, perhaps someone else on the list can help
you with VS2013.
HTH,
Cory
On Wed, Jul 27, 2016 at 11:09 AM, Prajwal Sapare <prajwal.sapare at gmail.com>
wrote:
> Yes I know it's a linker error.
> I followed all the steps given.
>
> Step1: Linking of INCLUDE files in VS2013 of CMAKE_INSTALL Prefix path
> Step2: Linking of LIB files in VS2013 of CMAKE_INSTALL Prefix path
> Step3: Adding of of LIB files name used in program to additional
> dependencies in Linker C++.
> Step4: Adding Bin folder path to system variables.
>
> Anything apart from this? Do you know any link or tutorial that
> defines the procedure properly?
>
> Regards,
> Prajwal
>
> On Wed, Jul 27, 2016 at 4:58 PM, Cory Quammen
> <cory.quammen at kitware.com>
> wrote:
>>
>> The error is a linker error that indicates you are not linking
>> against the VTK libraries.
>>
>> HTH,
>> Cory
>>
>> On Wed, Jul 27, 2016 at 9:52 AM, Prajwal Sapare
>> <prajwal.sapare at gmail.com> wrote:
>> >
>> > I just try to build a sample program, but I am getting an error
>> > stating this...
>> >
>> >
>> > 1>------ Build started: Project: ConsoleApplication1, Configuration:
>> > Debug
>> > Win32 ------
>> > 1> stdafx.cpp
>> > 1> ConsoleApplication1.cpp
>> > 1>ConsoleApplication1.obj : error LNK2019: unresolved external
>> > 1>symbol
>> > "__declspec(dllimport) public: class vtkAlgorithmOutput *
>> > __thiscall vtkAlgorithm::GetOutputPort(void)"
>> > (__imp_?GetOutputPort at vtkAlgorithm@@QAEPAVvtkAlgorithmOutput@@XZ)
>> > referenced
>> > in function _main
>> > 1>D:\syncplicity\z003npra\Documents\Visual Studio
>> > 2013\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe :
>> > fatal error LNK1120: 1 unresolved externals ========== Build: 0
>> > succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>> >
>> >
>> >
>> > My code is: (A code from internet)
>> >
>> >
>> > *******************************************************************
>> > ************************************
>> >
>> > #include "stdafx.h"
>> > #include <windows.h>
>> >
>> >
>> > #include <vtkSmartPointer.h>
>> >
>> > #include <vtkActor.h>
>> > #include <vtkCubeSource.h>
>> > #include <vtkPolyData.h>
>> > #include <vtkPolyDataMapper.h>
>> > #include <vtkRenderWindow.h>
>> > #include <vtkRenderWindowInteractor.h> #include <vtkRenderer.h>
>> >
>> > int main(int, char *[])
>> > {
>> > // Create a cube.
>> > vtkSmartPointer<vtkCubeSource> cubeSource =
>> > vtkSmartPointer<vtkCubeSource>::New();
>> >
>> > // Create a mapper and actor.
>> > vtkSmartPointer<vtkPolyDataMapper> mapper =
>> > vtkSmartPointer<vtkPolyDataMapper>::New();
>> > mapper->SetInputConnection(cubeSource->GetOutputPort());
>> >
>> > vtkSmartPointer<vtkActor> actor =
>> > vtkSmartPointer<vtkActor>::New();
>> > actor->SetMapper(mapper);
>> >
>> > // Create a renderer, render window, and interactor
>> > vtkSmartPointer<vtkRenderer> renderer =
>> > vtkSmartPointer<vtkRenderer>::New();
>> > vtkSmartPointer<vtkRenderWindow> renderWindow =
>> > vtkSmartPointer<vtkRenderWindow>::New();
>> > renderWindow->AddRenderer(renderer);
>> > vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
>> > vtkSmartPointer<vtkRenderWindowInteractor>::New();
>> > renderWindowInteractor->SetRenderWindow(renderWindow);
>> >
>> > // Add the actors to the scene
>> > renderer->AddActor(actor);
>> > renderer->SetBackground(.3, .2, .1);
>> >
>> > // Render and interact
>> > renderWindow->Render();
>> > renderWindowInteractor->Start();
>> >
>> > return EXIT_SUCCESS;
>> > }
>> >
>> >
>> >
>> > *******************************************************************
>> > ***********************************
>> >
>> > Please let me know regarding this.
>> >
>> >
>> > Regards,
>> > Prajwal
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the VTK FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> >
>> > Search the list archives at: http://markmail.org/search/?q=vtkusers
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://public.kitware.com/mailman/listinfo/vtkusers
>> >
>>
>>
>>
>> --
>> Cory Quammen
>> R&D Engineer
>> Kitware, Inc.
>
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list