Search code examples
eclipse-cdtgstreamer

Eclipse CDT, how to build with Gstreamer?


I am new at BigCompany and have been given a subsystem & told to build it under Linux, since I was dumb enough to suggest unit test (there has never been a unit test & all builds are currently for an ARM processor).

Some code, which no one knows anything about, uses GStreamer. It has statements like

#include "gst/gst.h"
#include "gst/gsttaglist.h"

which give the GCC error

fatal error: gst/gst.h: No such file or directory   

I grepped and found it in

/opt/tooling/imx6-staging/DI_BINARY_REPOSITORY_IMX6_LINUX_14.0F46/usr/include/gstreamer-0.10/gst/gst.h

so I went to project Properties/C & C++ General/paths and symbols and added

/opt/tooling/imx6-staging/DI_BINARY_REPOSITORY_IMX6_LINUX_14.0F46/usr/include/gstreamer-0.10

to the path. The error persisted.

I also tried adding gstreamer-0.10 to the libraries, but to no avail.

How do I get this to compile in Eclipse CDT?


Solution

  • You're doing the right thing, and what Scooter describes is correct. However I'd add that in my experience, tracking down all the GStreamer and GLib paths is a pain and it always seemed like Eclipse didn't like when I added them manually.

    For our Eclipse/GStreamer projects the build tool we find most useful is CMake. It's a Makefile make tool that offers Eclipse project file generation also. So in a file CMakeLists.txt we'd have something like this:

    cmake_minimum_required(VERSION 2.8)
    
    project(myproj)
    
    include(FindPkgConfig)
    
    pkg_check_modules(GST REQUIRED gstreamer-app-1.0)
    pkg_check_modules(LIBLOG4CXX REQUIRED liblog4cxx)
    
    include_directories(${GST_INCLUDE_DIRS} ${LIBLOG4CXX_INCLUDE_DIRS})
    link_directories(${GST_LIBRARY_DIRS} ${LIBLOG4CXX_LIBRARY_DIRS})
    
    add_executable(myproj myproj.cpp)
    
    target_link_libraries(myproj ${GST_LIBRARIES} ${LIBLOG4CXX_LIBRARIES})
    

    Then from the command line, I point the environment to whatever pkg-config path I'm using and run cmake.

    export PKG_CONFIG_PATH=/opt/whatever/pkgconfig
    cmake --clean-first . -G "Eclipse CDT4 - Unix Makefiles"
    

    Now open up the project in Eclipse. You may have to Index->Rebuild but after that it works great in my experience.

    Another benefit of this is if you're working on a team project you don't have to create the Eclipse project files from hand for each project member, or try to share machine-specific project files across users.