Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt LNK2019: unresolved external symbol "__declspec(dllimport)..." VTK
QtWS25 Last Chance

Qt LNK2019: unresolved external symbol "__declspec(dllimport)..." VTK

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
15 Posts 5 Posters 9.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AnaM
    wrote on last edited by
    #1

    Hello!

    I am new with Qt and VTK.
    I think I installed everything correctly (VTK in Release mode).

    I am trying to run the example in VTK/Examples/Cxx/Qt/BorderWidgetQt. I use CMake, then I open the solution in VS2010 and it builds perfectly (release mode).

    BUT, when I try to build the exact same project in Qt Creator I have this errors:

    borderwidgetqt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkBorderWidget * __cdecl vtkBorderWidget::New(void)" (_imp?New@vtkBorderWidget@@SAPEAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkBorderWidget> __cdecl vtkSmartPointer<class vtkBorderWidget>::New(void)" (?New@?$vtkSmartPointer@VvtkBorderWidget@@@@SA?AV1@XZ)

    borderwidgetqt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: class vtkAlgorithmOutput * __cdecl vtkAlgorithm::GetOutputPort(int)" (_imp?GetOutputPort@vtkAlgorithm@@QEAAPEAVvtkAlgorithmOutput@@H@Z) referenced in function "public: __cdecl BorderWidgetQt::BorderWidgetQt(void)" (??0BorderWidgetQt@@QEAA@XZ)

    borderwidgetqt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkSphereSource * __cdecl vtkSphereSource::New(void)" (_imp?New@vtkSphereSource@@SAPEAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkSphereSource> __cdecl vtkSmartPointer<class vtkSphereSource>::New(void)" (?New@?$vtkSmartPointer@VvtkSphereSource@@@@SA?AV1@XZ)

    It seems that Qt is having problems in finding the dll?

    My .pro file is:

    QT += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = BorderWidgetQt
    TEMPLATE = app
    SOURCES += main.cpp
    borderwidgetqt.cpp
    HEADERS += borderwidgetqt.h
    FORMS += borderwidgetqt.ui
    INCLUDEPATH += C:\VTK-7\install\include\vtk-7.0
    LIBS += -L"C:\VTK-7\install\lib"
    -lvtkRenderingCore-7.0
    -lvtkChartsCore-7.0
    -lvtkCommonCore-7.0
    -lvtkFiltersCore-7.0
    -lvtkGUISupportQt-7.0
    -lvtkImagingCore-7.0
    -lvtkInfovisCore-7.0
    -lvtkIOCore-7.0
    -lvtkViewsCore-7.0

    How can I fix this?

    Please, I am stuck in here and I can't find any solution for that... I already tried build the project in Qt both in release and debug mode but the errors are the same...

    Thank you in advance!!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you trying to build this example ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A Offline
        A Offline
        AnaM
        wrote on last edited by AnaM
        #3

        Hello! Thank you!

        Yes that example! Any help?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I missed something the first time I read your thread. Visual Studio 2010 ? Did you build VTK yourself with that version of VS ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            To add to @SGaist ,
            In Creator, you also have selected VS2010 as compiler ?

            1 Reply Last reply
            0
            • SGaistS SGaist

              I missed something the first time I read your thread. Visual Studio 2010 ? Did you build VTK yourself with that version of VS ?

              A Offline
              A Offline
              AnaM
              wrote on last edited by
              #6

              Hello!

              I build VTK myself with VS! I build with Release mode, should I build with Debug mode instead?

              How do I select VS as compiler in Qt?

              Thank you very much!!

              jsulmJ 1 Reply Last reply
              0
              • A AnaM

                Hello!

                I build VTK myself with VS! I build with Release mode, should I build with Debug mode instead?

                How do I select VS as compiler in Qt?

                Thank you very much!!

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @AnaM http://doc.qt.io/qtcreator/creator-tool-chains.html

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                A 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @AnaM http://doc.qt.io/qtcreator/creator-tool-chains.html

                  A Offline
                  A Offline
                  AnaM
                  wrote on last edited by
                  #8

                  @jsulm Yes, The VS is selected as the compiler.
                  Maybe the problem is the build mode?(release/debug)?

                  Thank you again

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    I might be insisting but do you have everything build with the same version of MSVC ? Same architecture ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    A 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      I might be insisting but do you have everything build with the same version of MSVC ? Same architecture ?

                      A Offline
                      A Offline
                      AnaM
                      wrote on last edited by
                      #10

                      @SGaist Yes, everthing was build with MSVC same version.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Wouldn't you be missing the vtkWidgets library in your .pro file ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        A 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Wouldn't you be missing the vtkWidgets library in your .pro file ?

                          A Offline
                          A Offline
                          AnaM
                          wrote on last edited by
                          #12

                          @SGaist No.
                          Maybe it's because I am building my project in VS 64 bit and Qt only detects VS compiler 32 bit?
                          How can I make Qt work with 64 bit?

                          Thank you!!

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by SGaist
                            #13

                            You have to install a 64bit build of Qt. You can't mix and match libraries of different architectures.

                            [Edit: fixed wording... Thanks @jsulm]

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            jsulmJ 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              You have to install a 64bit build of Qt. You can't mix and match libraries of different architectures.

                              [Edit: fixed wording... Thanks @jsulm]

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @SGaist said in Qt LNK2019: unresolved external symbol "__declspec(dllimport)..." VTK:

                              You can mix

                              You can't mix :-)

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • W Offline
                                W Offline
                                wilmer
                                wrote on last edited by
                                #15

                                Hola , para yo resolver este error cambie de modo DEBUG a RELEASE y corrio mi app.

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved