Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [Problem][semi-solved] with linking libvlc to qt
Forum Updated to NodeBB v4.3 + New Features

[Problem][semi-solved] with linking libvlc to qt

Scheduled Pinned Locked Moved 3rd Party Software
17 Posts 2 Posters 7.9k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    prawdziwy-sok
    wrote on last edited by
    #1

    Hi guys, I'm trying to make a simple application that uses libvlc, on windows 8.1 using Qt 5.2.1 (MSVC 2010, 32 bit) with minGW.
    my code is:
    @#include <QCoreApplication>
    #include <iostream>
    #include <vlc/vlc.h>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    libvlc_instance_t * inst = libvlc_new(argc, argv);
    
    return a.exec&#40;&#41;;
    

    }
    @

    As you see, nothing fancy.
    .pro file:
    @
    #-------------------------------------------------

    Project created by QtCreator 2014-04-29T00:40:02

    #-------------------------------------------------

    QT += core

    QT -= gui

    TARGET = libvlcTest
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp

    unix|win32: LIBS += -L$$PWD/../../../Programs/VideoLAN/VLC/sdk/lib/ -llibvlccore

    INCLUDEPATH += $$PWD/../../../Programs/VideoLAN/VLC/sdk/include
    DEPENDPATH += $$PWD/../../../Programs/VideoLAN/VLC/sdk/include

    unix|win32: LIBS += -L$$PWD/../../../Programs/VideoLAN/VLC/sdk/lib/ -llibvlc

    INCLUDEPATH += $$PWD/../../../Programs/VideoLAN/VLC/sdk/include
    DEPENDPATH += $$PWD/../../../Programs/VideoLAN/VLC/sdk/include
    @

    It builds fine, but when i try to run it, i get two message boxes with errors- one saying "the gdb process terminated unexpectedly(code 0)" and the other one "During startup program exited with code 0xc0000135".
    I have no idea what to do- googled for a lot of time today, and nothing helps. So, does anyone have any idea what might help me?
    Btw, information provided on what one should do to link libvlc to his project are very unclear, i just clicked "add library" in the .pro file and used the path to the libvlc.lib and libvlccore.lib (and paths to their headers).

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

      Hi and welcome to devnet,

      Do you have the path to the VLC dlls in your PATH environment variable ? If not, go to the run tab in the Project panel and add it there

      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
      0
      • P Offline
        P Offline
        prawdziwy-sok
        wrote on last edited by
        #3

        I pasted the path to the PATH in the run tab, and even tried with the system PATH, but it changes nothing- program stops as soon as it starts and gives me the mentioned errors.
        When i try this:
        @#include <QCoreApplication>
        #include <iostream>
        #include <vlc/vlc.h>

        int main(int argc, char *argv[])
        {
        QCoreApplication a(argc, argv);
        std::cout<<"szatan";
        libvlc_instance_t * inst = libvlc_new(argc, argv);
        std::cout<<"szatan";
        return a.exec();
        }@
        it displays nothing.
        thanks for your help, do you, or anyone else have any suggestions?

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

          Just saw something strange, are you really using Qt for MSVC 2010 and trying to compile stuff with MinGW ?

          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
          0
          • P Offline
            P Offline
            prawdziwy-sok
            wrote on last edited by
            #5

            hmm, that is weird, though everything else compiles nicely:P
            It only says "Qt 5.2.1 (MSVC 2010, 32 bit)" in the Help->About Qt creator window, in my Project tab the qt version is QT 5.2.1 MinGw 32 bit. So i guess thats not the problem here...

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

              That's the Qt version used to build Qt Creator. It's not relevant in this case. What is important is the Qt Version from your Kit which is currently indeed the MinGW build.

              Do you know what compiler was used to build the VLC sdk ?

              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
              0
              • P Offline
                P Offline
                prawdziwy-sok
                wrote on last edited by
                #7

                MinGW, i think (its the native method, at least thats what their wiki says, also its in the pkgconfig files next to the .lib files). i know that libraries should be compiled with the same compiler that im using, I just hope that does'nt have to be the same version of compiler.

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

                  IIRC, MinGW 4.6 is not compatible with 4.8

                  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
                  0
                  • P Offline
                    P Offline
                    prawdziwy-sok
                    wrote on last edited by
                    #9

                    Ok, so I have discovered, that libvlc is compatible only with qt4.6 7 and 8. In order to run it with qt5, you need to recompile it. I failed at that on windows, but on ubuntu (and for ubuntu- my cross compile attempt also failed miserably) I managed to compile and run it :)
                    links to relevant things in the internet:
                    http://ubuntuforums.org/showthread.php?t=2141949
                    https://forum.videolan.org/viewtopic.php?f=32&t=119194
                    https://forum.videolan.org/viewtopic.php?f=32&t=119141

                    But now i have a Qt (even without using libvlc) problem- i have downloaded Qt 4.8, installed it, but when i try to build with it, i get GDB error
                    "The gdb process terminated unexpectedly (code 0)". I made a new kit in build&run menu, and my settings are:
                    Compiler- MinGW 4.8 32 bit (same as in working Qt5.2.1 kit)
                    Debugger- extracted from Kit desktop Qt5.2.1 (the working one)
                    Qt version 4.8.6
                    Is the debugger the source of my problem? Should I download a newer version of gdb?
                    I am not sure that the debugger is the source of my problem - if I build and then run program without debug, or just plain remove debugger from kit, the program just doesn't do anything -
                    @int main(int argc, char *argv[])
                    {
                    QCoreApplication a(argc, argv);
                    std::cout<<"test";
                    int e = 0;
                    std::cin>>e;

                    return a.exec&#40;&#41;;
                    

                    }@
                    does nothing. (since this is a qt issue, should i post about that elsewhere?)

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

                      Just to rule out the obvious, you installed the 4.8.6 MinGW version ?

                      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
                      0
                      • P Offline
                        P Offline
                        prawdziwy-sok
                        wrote on last edited by
                        #11

                        Yep;)

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

                          How many versions of Qt do you have installed ? Also which version of Qt Creator do you currently use ?

                          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
                          0
                          • P Offline
                            P Offline
                            prawdziwy-sok
                            wrote on last edited by
                            #13

                            I have Qt Creator 3.1.0, and my qt versions are: 4.8.6 and 5.2.1
                            And sorry, i missed one thing- i don't just get one error when trying to debug my program, i get three:
                            “The gdb process terminated unexpectedly (code 0)”
                            "Cannot continue debugged process:
                            The program is not being run." and
                            "During startup program exited with code 0xc0000139."
                            If I just run it without debug, it exits without doing anything.

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

                              That means it can't find one or more dll at startup. Are you sure you have all paths set in your PATH environment variable ?

                              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
                              0
                              • P Offline
                                P Offline
                                prawdziwy-sok
                                wrote on last edited by
                                #15

                                Well, the only difference between the paths from the two kits( 5.2.1 and 4.8.6) are the locations of the qt libraries themselves... should there be any other differences? can these two kits use the same compiler (mingw that came with qt 5.2.1)?

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

                                  Then you need to add the path to the vlc lib dlls so they can be found at startup

                                  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
                                  0
                                  • P Offline
                                    P Offline
                                    prawdziwy-sok
                                    wrote on last edited by
                                    #17

                                    Well, I'm having a Qt issue now, because i was talking about simple emtpy program. So I'll say that this topic is answered, and start a new one in approporiate place:) Thanks for your help!

                                    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