Results 1 to 16 of 16

Thread: Including external header (gst.h)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Including external header (gst.h)

    Good day fellow programmers,

    I am trying to include Gstreamer into my Qt application.
    In order to do so I need to include "gst.h".

    So far I've tried to simply add it to the main.cpp file.
    Qt Code:
    1. #include <gst/gst.h>
    To copy to clipboard, switch view to plain text mode 
    I've also tried the direct file path:
    Qt Code:
    1. #include "/usr/include/gstreamer-1.0/gst/gst.h"
    To copy to clipboard, switch view to plain text mode 

    I've also tried specifying an INCLUDEPATH in the .pro file:
    Qt Code:
    1. INCLUDEPATH += /usr/include/gstreamer-1.0/gst
    To copy to clipboard, switch view to plain text mode 
    As this didn't work I tried to be a bit more specific:
    Qt Code:
    1. unix:INCLUDEPATH += /usr/include/gstreamer-1.0/gst
    To copy to clipboard, switch view to plain text mode 

    During these tries I've been using the command in main.cpp
    Qt Code:
    1. #include <gst/gst.h>
    To copy to clipboard, switch view to plain text mode 
    but received the error all the time
    Qt Code:
    1. /home/finn/GST_Test2/main.cpp:2: error: gst/gst.h: No such file or directory
    To copy to clipboard, switch view to plain text mode 
    .

    Besides that I also tried using PKGCONFIG:
    Qt Code:
    1. unix {
    2. CONFIG += link_pkgconfig
    3. PKGCONFIG += gstreamer-1.0
    4. }
    To copy to clipboard, switch view to plain text mode 

    According to this commands result gstreamer-1.0 exists on the target system.
    Qt Code:
    1. pkg-config --list-all | grep gstreamer
    To copy to clipboard, switch view to plain text mode 

    However I always receive the error
    Qt Code:
    1. :-1: error: Package gstreamer-1.0 not found
    To copy to clipboard, switch view to plain text mode 

    The target system is a Raspberry Pi running Linux Debian. I've been able to successfully build applications on that system which is why I would guess that the target system should not be the problem.

    The file gst.h does exist on the target system in the directory /usr/include/gstreamer-1.0/gst

    Does anyone has an idea how to properly include gst.h into my Qt project?
    Thanks a lot!

    Best regards,
    Plox

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Including external header (gst.h)

    INCLUDEPATH += /usr/include/gstreamer-1.0/gst
    but you try to include the header with "gst/gst.h", compiler can't find it because probably there is no "gst" subdir in "/usr/include/gstreamer-1.0/gst" directory.
    If the file path is "/usr/include/gstreamer-1.0/gst/gst.h" then you need to add "INCLUDEPATH += /usr/include/gstreamer-1.0/" and include with "gst/gst.h", or "INCLUDEPATH += /usr/include/gstreamer-1.0/gst" and include with #include <gst.h>

  3. The following user says thank you to stampede for this useful post:

    Plox (15th October 2013)

  4. #3
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Including external header (gst.h)

    Thank you for your answer, stampede.

    I modified said code lines.

    This is the .pro file:
    Qt Code:
    1. INCLUDEPATH += /usr/include/gstreamer-1.0/
    To copy to clipboard, switch view to plain text mode 

    And this is the main.cpp:
    Qt Code:
    1. #include "gst/gst.h"
    To copy to clipboard, switch view to plain text mode 

    Sadly I am still getting the error:
    Qt Code:
    1. /home/finn/GST_Test2/main.cpp:2: error: gst/gst.h: No such file or directory
    To copy to clipboard, switch view to plain text mode 

    Why does this error still occur?

    Thanks a lot!

  5. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Including external header (gst.h)

    gstreamer-1.0 exists on the target system
    By "target system" you mean the system on which you want to deploy your app, or the machine where you are trying to build the app ? I'm just confused about the term "target system".
    This file should be present on the build machine. Does it exist on your computer (the one where you are developing the app) ?

  6. The following user says thank you to stampede for this useful post:

    Plox (15th October 2013)

  7. #5
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Including external header (gst.h)

    I am developing my app on a desktop pc running Ubuntu for a Raspberry Pi running Debian.
    The file I want to include only exists on the Raspberry.

    Do I need to copy it onto the Ubuntu machine in order to use it, although it's functionality is only going to be used on the Raspberry?

  8. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Including external header (gst.h)

    Yes, your compiler needs to have access to all the headers and libraries in order to build your application. Make sure to install the gstreamer package in development version.

  9. The following user says thank you to stampede for this useful post:

    Plox (15th October 2013)

  10. #7
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Including external header (gst.h)

    Allright, thanks a lot for your help, I greatly appreciate it!

    One last question: What is the difference between the regular gstreamer version and dev version?

  11. #8
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Including external header (gst.h)

    Regular version doesn't include headers required for developing applications using gstreamer, only shared libraries:
    file list for regular libgstreamer
    file list for libgstreamer-dev
    Last edited by stampede; 15th October 2013 at 14:04. Reason: updated contents

  12. The following user says thank you to stampede for this useful post:

    Plox (15th October 2013)

  13. #9
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Including external header (gst.h)

    I am afraid that I'll need help in another matter regarding this development step too.

    I've installed gstreamer on the Ubuntu machine, set the proper INCLUDEPATH and included gst.h into main.cpp.
    A look into the file system confirms that gstreamer has been successfully installed as all header files seem to be present.

    After resolving some issues regarding glib all dependencies seem to be sorted out, however I am experiencing an error as soon as I try to actually call functions from gst.h.

    This is the error I receive:
    Qt Code:
    1. undefined reference to 'gst_init'
    To copy to clipboard, switch view to plain text mode 

    As I am receiving this error for every gst.h function I reduced main.cpp to only include gst_init.
    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include <gst/gst.h>
    3.  
    4. int main(int argc, char *argv[]){
    5. QCoreApplication a(argc, argv);
    6.  
    7. gst_init (NULL,NULL);
    8. return a.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 


    The file gst.h is where it's supposed to be and based on the fact that Creator even suggests "gst_init" once I type e.g "gst" into main.cpp and since the function "gst_init" is underlayed with that typical grey box I think that gst.h has been successfully included into this project.

    Why do I still receive such error messages?

    Thanks a lot for your help!

  14. #10
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Including external header (gst.h)

    "Undefined reference ..." is a linker error, you need to add library path and link to gst libraries, in .pro file:
    LIBS += -L /path/to/gstreamer/libraries
    LIBS += <gstreamer cflags>
    I dont know what are the parameters exactly, try "pkg-config --cflags --libs gstreamer-1.0" to get the values.
    btw. I think you will find some useful informations here

  15. #11
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Including external header (gst.h)

    That makes sense. This will be the first thing to be tried out tomorrow morning.

    Thank you for your help, this really made my day.

Similar Threads

  1. Replies: 2
    Last Post: 4th January 2012, 13:26
  2. How to add external Header files and libraries?
    By askbapi in forum Installation and Deployment
    Replies: 6
    Last Post: 30th September 2010, 17:33
  3. Qt Creator PROBLEM INCLUDING 'QSystemInfo' HEADER FILE
    By Rakula in forum Qt Tools
    Replies: 1
    Last Post: 24th September 2010, 09:28
  4. Replies: 2
    Last Post: 28th February 2010, 07:38
  5. Replies: 1
    Last Post: 6th November 2009, 21:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.