[vtkusers] Can't generate executable file from Cone.cxx example

Cory Quammen cory.quammen at kitware.com
Fri Jul 17 08:40:53 EDT 2015


Hmm, I would try to remove the line

set(VTK_DIR $HOME/build-VTK)

and set that manually though ccmake and see if that works.

Cory

On Fri, Jul 17, 2015 at 8:11 AM, Paolo Grossi <smoldino at gmail.com> wrote:

> Thanks Cory for your quick answer.
> I didn't receive an error during the configuration with ccmake.
> I tried to build the example outside the main directory and to correct the
> CMakeLists.txt, but the result is always the same.
>
> Regards,
> Paolo Grossi.
>
> On 17 July 2015 at 13:01, Cory Quammen <cory.quammen at kitware.com> wrote:
>
>> Paolo,
>>
>> Did you get an error when configuring with ccmake? It looks like the VTK
>> include directories are not being set properly.
>>
>> I would also recommend putting the example code and CMakeLists.txt file
>> in a directory outside your VTK build directory. I'm not sure that this is
>> causing the problem, but it is good practice to build dependent projects
>> outside the VTK build directory.
>>
>> Also, in your CMakeLists.txt file, I think you can access your HOME
>> environment variable with
>>
>> $ENV{HOME}
>>
>> not
>>
>> $HOME
>>
>> Thanks,
>> Cory
>>
>> On Fri, Jul 17, 2015 at 6:56 AM, Paolo Grossi <smoldino at gmail.com> wrote:
>>
>>> Greetings to the whole community of VTK,
>>> I'm a newbie user!
>>>
>>> After the installation of VTK on my PC (Ubuntu 14.04.2), I was trying to
>>> run the example linked here:
>>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Cone
>>> During the installation I selected the "BUILD EXAMPLE" option.
>>> I also unselected the "BUILD SHARED LIBS" option, because I can't
>>> proceed with the installation if I had selected it.
>>>
>>> My steps were:
>>> 1) created the file Cone.cxx into the directory
>>> "$HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CmakeFiles/Cone.dir" with the
>>> text:
>>>
>>> #include <vtkConeSource.h>
>>> #include <vtkPolyData.h>
>>> #include <vtkSmartPointer.h>
>>> #include <vtkPolyDataMapper.h>
>>> #include <vtkActor.h>
>>> #include <vtkRenderWindow.h>
>>> #include <vtkRenderer.h>
>>> #include <vtkRenderWindowInteractor.h>
>>>
>>> int main(int, char *[])
>>> {
>>>   //Create a cone
>>>   vtkSmartPointer<vtkConeSource> coneSource =
>>> vtkSmartPointer<vtkConeSource>::New();
>>>   coneSource->Update();
>>>
>>>   //Create a mapper and actor
>>>   vtkSmartPointer<vtkPolyDataMapper> mapper =
>>> vtkSmartPointer<vtkPolyDataMapper>::New();
>>>   mapper->SetInputConnection(coneSource->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); // Background color dark red
>>>
>>>   //Render and interact
>>>   renderWindow->Render();
>>>   renderWindowInteractor->Start();
>>>
>>>   return EXIT_SUCCESS;
>>> }
>>>
>>> 2) created the file CMakeLists.txt into the same directory above with
>>> the text:
>>>
>>> cmake_minimum_required(VERSION 2.8)
>>> project(Cone)
>>> set(VTK_DIR $HOME/build-VTK)
>>> find_package(VTK REQUIRED)
>>> include(${VTK_USE_FILE})
>>> add_executable(Cone Cone.cxx)
>>> if(VTK_LIBRARIES)
>>>   target_link_libraries(Cone ${VTK_LIBRARIES})
>>> else()
>>>   target_link_libraries(Cone vtkHybrid vtkWidgets)
>>> endif()
>>>
>>> 3) typed the command "ccmake ." into the same directory above, pressed
>>> the C button and the G button
>>>
>>> 4) typed the command "make" into the same directory above, receiving the
>>> error explained below:
>>>
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:19:27:
>>> error: vtkConeSource.h: No such file or directory
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:20:31:
>>> error: vtkPolyDataMapper.h: No such file or directory
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:21:29:
>>> error: vtkRenderWindow.h: No such file or directory
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:22:23:
>>> error: vtkCamera.h: No such file or directory
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:23:22:
>>> error: vtkActor.h: No such file or directory
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:24:25:
>>> error: vtkRenderer.h: No such file or directory
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:
>>> In function ‘int main()’:
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:34:
>>> error: ‘vtkConeSource’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:34:
>>> error: ‘cone’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:34:
>>> error: ‘vtkConeSource’ is not a class or namespace
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:46:
>>> error: ‘vtkPolyDataMapper’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:46:
>>> error: ‘coneMapper’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:46:
>>> error: ‘vtkPolyDataMapper’ is not a class or namespace
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:56:
>>> error: ‘vtkActor’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:56:
>>> error: ‘coneActor’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:56:
>>> error: ‘vtkActor’ is not a class or namespace
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:65:
>>> error: ‘vtkRenderer’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:65:
>>> error: ‘ren1’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:65:
>>> error: ‘vtkRenderer’ is not a class or namespace
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:74:
>>> error: ‘vtkRenderWindow’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:74:
>>> error: ‘renWin’ was not declared in this scope
>>> $HOME/build-VTK/Examples/Tutorial/Step1/Cxx/CMakeFiles/Cone.dir/Cone.cxx:74:
>>> error: ‘vtkRenderWindow’ is not a class or namespace
>>> make[2]: *** [CMakeFiles/Cone.dir/Cone.cxx.o] Error 1
>>> make[1]: *** [CMakeFiles/Cone.dir/all] Error 2
>>> make: *** [all] Error 2
>>>
>>> I have really no idea about the solution of this problem.
>>> Sorry for my incompetence!
>>> I'm looking forward to hear you.
>>>
>>> Thanks,
>>> Paolo Grossi.
>>>
>>> _______________________________________________
>>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150717/f62264d6/attachment.html>


More information about the vtkusers mailing list