Important: Please read the Qt Code of Conduct -

Error: :cannot specify -o when generating multiple output files VTK + QT

  • Hi guys!
    After a few searchs i resolve the error of not find de libraries of vtk with this:
    LIBS += -L"/usr/local/include/vtk-6.2/QVTKApplication.h"

    But now i have this error:
    clang: error: cannot specify -o when generating multiple output files
    make: *** [Pandora] Error 1

    I'm not familiar with this error, can anyone help me?

  • Hi,

    LIBS is used for linking libraries; you're using for header files.
    Can you post the .pro file??

  • @mcosta My pro file:
    INCLUDEPATH += "/usr/include/vtk-6.2/"
    LIBS += -L"/usr/lib/vtk-6.2" -lvtkCommon -lvtksys -lQVTK -lvtkRendering -lvtkGraphics -lvtkIO -lvtkInfovis -lvtkViews -lvtkFiltering -lvtkHybrid -lvtkWidgets

    I correct my error, but the qt is not find the vtk libraries. Any tips?

  • @Lays147 said:

    but the qt is not find the vtk libraries

    What does it mean??
    What's the output of make??

  • Follow:
    In file included from ../Pandora/main.cpp:1:
    ../Pandora/brprint3d.h:21:10: fatal error: 'QVTKApplication.h' file not found
    #include <QVTKApplication.h>

  • Hi,

    is the file QVTKApplication.h inside /usr/include/vtk-6.2/ ??

  • @mcosta I made a mistake, now this is my pro file:
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = Pandora
    TEMPLATE = app
    TRANSLATIONS = EN_english.ts

    SOURCES += main.cpp

    HEADERS += brprint3d.h
    warning.h \

    FORMS +=



    But i'm still have problems, if i do this way:

    INCLUDEPATH += "/usr/local/include/vtk-6.2/"
    LIBS += -L"/usr/local/lib" -lvtksys -lQVTK -lvtkRendering -lvtkGraphics -lvtkIO -lvtkInfovis -lvtkViews -lvtkFiltering -lvtkHybrid -lvtkWidgets

    I'm get this errors:
    /usr/bin/ld: cannot find -lvtkCommon
    /usr/bin/ld: cannot find -lvtksys
    /usr/bin/ld: cannot find -lQVTK
    /usr/bin/ld: cannot find -lvtkRendering
    /usr/bin/ld: cannot find -lvtkGraphics
    /usr/bin/ld: cannot find -lvtkIO
    /usr/bin/ld: cannot find -lvtkInfovis
    /usr/bin/ld: cannot find -lvtkViews
    /usr/bin/ld: cannot find -lvtkFiltering
    /usr/bin/ld: cannot find -lvtkHybrid

    If i do this:
    INCLUDEPATH += "/usr/local/include/vtk-6.2/"
    LIBS += -L"/usr/local/lib"
    I get this errors:
    "../Pandora/brprint3d.cpp:(.text+0x49cc): undefined reference to `vtkSmartPointerBase::~vtkSmartPointerBase()'"

    How to link the libraries?

  • Hi are the libraries inside /usr/local/lib?

    What's the full name of the library file?

  • @mcosta this printscreen should help:

  • Hi,

    I think that you should add -6.2 to the name of all libraries in LIBS

    LIBS += -L/usr/local/lib -lvtkCommonCore-62 .....

    the name scheme passed to the linker is this
    -l<lib_name> looks for a file called lib<lib_name>.so

  • @mcosta I did this:
    INCLUDEPATH += "/usr/local/include/vtk-6.2/"
    LIBS += -L"/usr/local/lib" -lvtkCommonCore-6.2 -lvtkalglib-6.2 -lvtkChartsCore-6.2 -lvtkDICOMParser-6.2 -lvtkDomainsChemistry-6.2 -lvtkexpat-6.2
    -lvtkFiltersCore-6.2 -lvtkfreetype-6.2 -lvtkGeovisCore-6.2 -lvtkgl2ps-6.2 -lvtkGUISupportQt-6.2 -lvtkhdf5-6.2 -lvtkImagingCore-6.2 -lvtkInfovisCore-6.2
    -lvtkInteractionImage-6.2 -lvtkInteractionStyle-6.2 -lvtkInteractionWidgets-6.2 -lvtkIOCore-6.2 -lvtkParallelCore-6.2 -lvtkRenderingCore-6.2 -lvtksys-6.2 -lvtkViewsCore-6.2\ -lvtkViewsQt-6.2 -lvtkzlib-6.2

    And now i got this error:
    error: brprint3d.o: undefined reference to symbol '_ZN12vtkAlgorithm13GetOutputPortEi'

    Because of this: "If you get something that looks like:
    undefined reference to `__imp___ZN13vtkTIFFReader3NewEv' collect2: ld returned 1 exit status. You certainly forgot to pass in a library to your executable."
    But if i add all the vtk libs, how i forgot to pass a library?

    how to fix it?

  • Hi,

    sorry I don't know VTK so I can't help you.
    You could try to understand in which library vtkTIFFReader is defined and verify that that library is really loaded

  • Try to put
    #include <vtkAutoInit.h>

    VTK_MODULE_INIT( vtkRenderingOpenGL );
    VTK_MODULE_INIT( vtkInteractionStyle );
    VTK_MODULE_INIT( vtkRenderingFreeTypeOpenGL );
    VTK_MODULE_INIT( vtkRenderingFreeType );

    right before your main
    Also vtk has its own mailing list you could try there.
    I just have not used it on Linux for ages.

  • I alredy compiled my app, but now i have this error: no override found for 'vtkPolyDataMapper' when i run my app and try to read my file, the app crash.
    I discover that i need to use cmake, but i dont now how to write the cmakelists.txt

    @alex_malyu this is to put and works without build with cmake?

  • CMake is very easy to use (I prefer it to qmake).

    In the VTK website you find a lot of examples and here you can read some information how to use it to build applications using Qt

  • @Lays147

    I do not have to use cmake,
    We just build vtk and qt and link to them in VS project.

    If it is linked but you get run-time error it means there is lack of run-time initialization ( related to system/driver specific needs),
    If you used CMAKE this would be handled buy cot it generate.
    Above given code provides initialization of some modules and is sufficient for me .

Log in to reply