[vtkusers] Unable to run a sample program

Cory Quammen cory.quammen at kitware.com
Wed Jul 27 10:58:43 EDT 2016


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 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.


More information about the vtkusers mailing list