Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linking problem with Vlc Qt library

Linking problem with Vlc Qt library

Scheduled Pinned Locked Moved Unsolved General and Desktop
vlc-qtmsvc12link error
9 Posts 3 Posters 6.1k 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.
  • AyushExel204A Offline
    AyushExel204A Offline
    AyushExel204
    wrote on last edited by AyushExel204
    #1

    I have download VLC-Qt library from here . I unzipped and copied all files to my project folder. This is my .pro file :

    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = untitled7
    TEMPLATE = app
    SOURCES += main.cpp\
            mainwindow.cpp\
    
    HEADERS  += mainwindow.h\
    
    
    
    FORMS    += mainwindow.ui
    INCLUDEPATH += $$PWD\include
    LIBS += -Llib -lvlc-qt
    
    

    My main.cpp file :

    #include "mainwindow.h"
    #include <QApplication>
    #include <QStringList>
    #include <vlc-qt/Instance.h>
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
      QStringList list{"media.mp3"};
      VlcInstance h(list);
      return a.exec();
    }
    
    

    When I try to run this code it shows following errors:

    main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl VlcInstance::VlcInstance(class QStringList const &,class QObject *)" (__imp_??0VlcInstance@@QEAA@AEBVQStringList@@PEAVQObject@@@Z) referenced in function main
    main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl VlcInstance::~VlcInstance(void)" (__imp_??1VlcInstance@@UEAA@XZ) referenced in function main
    debug\untitled7.exe:-1: error: LNK1120: 2 unresolved externals
    

    I have tried rebuilding the project and ran Qmake but this this error keeps showing up. What am I doing wrong ? How can I fix this ?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      What am I doing wrong ?

      You're not linking to the vlc library.

      How can I fix this ?

      Link to the library. If it's in <your project dir>\vlc\lib\vlc-qt.lib you can do this by adding this to the .pro file:

      LIBS += -Lvlc\lib -lvlc-qt
      

      Adjust paths accordingly if you have vlc located elsewhere.

      Please note that if you downloaded the precompiled package (e.g. Windows 64-bit MSVC2012 Qt5) you will have to use the same compiler (VS2012) for your project. If you're using different compiler then you need to download the source package and build it yourself with your compiler.

      AyushExel204A 2 Replies Last reply
      0
      • Chris KawaC Chris Kawa

        What am I doing wrong ?

        You're not linking to the vlc library.

        How can I fix this ?

        Link to the library. If it's in <your project dir>\vlc\lib\vlc-qt.lib you can do this by adding this to the .pro file:

        LIBS += -Lvlc\lib -lvlc-qt
        

        Adjust paths accordingly if you have vlc located elsewhere.

        Please note that if you downloaded the precompiled package (e.g. Windows 64-bit MSVC2012 Qt5) you will have to use the same compiler (VS2012) for your project. If you're using different compiler then you need to download the source package and build it yourself with your compiler.

        AyushExel204A Offline
        AyushExel204A Offline
        AyushExel204
        wrote on last edited by AyushExel204
        #3

        @Chris-Kawa Okay so I have updated the .pro file and downloaded https://github.com/vlc-qt/vlc-qt/releases/tag/1.0.1t version which is compatible with msvc2013 but this time I am getting this error :

        :-1: error: LNK1104: cannot open file 'vlc-qt.lib'
        
        1 Reply Last reply
        0
        • Chris KawaC Chris Kawa

          What am I doing wrong ?

          You're not linking to the vlc library.

          How can I fix this ?

          Link to the library. If it's in <your project dir>\vlc\lib\vlc-qt.lib you can do this by adding this to the .pro file:

          LIBS += -Lvlc\lib -lvlc-qt
          

          Adjust paths accordingly if you have vlc located elsewhere.

          Please note that if you downloaded the precompiled package (e.g. Windows 64-bit MSVC2012 Qt5) you will have to use the same compiler (VS2012) for your project. If you're using different compiler then you need to download the source package and build it yourself with your compiler.

          AyushExel204A Offline
          AyushExel204A Offline
          AyushExel204
          wrote on last edited by
          #4

          @Chris-Kawa Okay so the linking problem is finally fixed but when the program runs it crashes showing this message:
          "The program has unexpectedly finished."

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Could be any number of problems.
            Is it compiled with exactly the same compiler version (i.e. MSVC update version)? Is it compiled with the same version of Qt as the one you use? Have you copied the vlc dlls to your app's output dir?

            AyushExel204A 1 Reply Last reply
            0
            • Chris KawaC Chris Kawa

              Could be any number of problems.
              Is it compiled with exactly the same compiler version (i.e. MSVC update version)? Is it compiled with the same version of Qt as the one you use? Have you copied the vlc dlls to your app's output dir?

              AyushExel204A Offline
              AyushExel204A Offline
              AyushExel204
              wrote on last edited by
              #6

              @Chris-Kawa How can I fix this issue? Is there any other way to play all video and audio formats using QMediaPlayer without using these VLC libraries ?

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

                Hi,

                Like @chris-kawa suggested, copy the VLC .dlls where the application was built. Or go to the Run part of the Project panel in Qt Creator and modify the PATH environment variable by adding the path to where the VLC .dlls files are located.

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

                AyushExel204A 1 Reply Last reply
                0
                • SGaistS SGaist

                  Hi,

                  Like @chris-kawa suggested, copy the VLC .dlls where the application was built. Or go to the Run part of the Project panel in Qt Creator and modify the PATH environment variable by adding the path to where the VLC .dlls files are located.

                  AyushExel204A Offline
                  AyushExel204A Offline
                  AyushExel204
                  wrote on last edited by
                  #8

                  @SGaist After copying the .dll files, when I open the application, this error message is displayed:
                  "the procedure entry point could not be located in dynamuc link library <location>\VLCQtCore.dll"

                  1 Reply Last reply
                  0
                  • Chris KawaC Offline
                    Chris KawaC Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Sounds like what I said earlier - the vlc dll was probably compiled with different Qt version than what you're using in your project. These need to match.

                    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