GStreamer Qt WINDOWS - windows

There is lot's of information about configuring .pro file for Qt in linux to run GStreamer. But it looks so difficult to do the same in WINDOWS. I downloaded Gst from their official site and ran an installer. Now it's in D:\gstreamer\1.0\x86 ... I found the only description from someone who tried to change qt .pro file. I did the same:
INCLUDEPATH += c:/gstreamer/1.0/x86/include \
c:/gstreamer/1.0/x86/include/gstreamer-1.0/gst \
c:/gstreamer/1.0/x86/include/glib-2.0\
c:/gstreamer/1.0/x86/include/glib-2.0/glib \
c:/gstreamer/1.0/x86/lib/glib-2.0/include
LIBS += -Lc:/gstreamer/1.0/x86/lib
CONFIG += c:/gstreamer/1.0/x86/lib/pkgconfig
And the project find , gives assistance when typing "gst_init(" and other stuff for gstreamer but it gives an error
undefined reference to gst_init
Here is the question. How to connect GStreamer in windows?
#include <QCoreApplication>
#include <gst/gst.h>
int main(int argc, char *argv[])
{
gst_init(NULL,NULL);
//g_print("abc");
return 0;
}
C:/Qt/Qt5.1.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory
'D:/Projects/AllTests/Qt/build-Console-Desktop_Qt_5_1_1_MinGW_32bit-Debug'
g++ -Wl,-subsystem,console -mthreads -o debug\Console.exe debug/main.o
-Lc:/gstreamer/1.0/x86/lib -LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Cored debug/main.o: In function main': D:\Projects\AllTests\Qt\build-Console-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../Console/main.cpp:8:
undefined reference togst_init' collect2.exe: error: ld returned 1
exit status Makefile.Debug:77: recipe for target 'debug\Console.exe'
failed mingw32-make[1]: * [debug\Console.exe] Error 1
mingw32-make[1]: Leaving directory
'D:/Projects/AllTests/Qt/build-Console-Desktop_Qt_5_1_1_MinGW_32bit-Debug'
makefile:34: recipe for target 'debug' failed mingw32-make: *
[debug] Error 2 00:20:18: Process
«C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\mingw32-make.exe» finishes with
code 2.

You have to specify the gstreamer libraries against which your binaries must be linked.
According to this documentation for qmake, by issuing LIBS += -Lc:/gstreamer/1.0/x86/lib you are instructing qmake to look for libraries within the given path, but not which of them to actually link to your binaries. I am not familiar with gstreamer, so I'm not sure what libraries must be linked in the specific case you presented, but I guess you'll find them all in gstreamer/1.0/x86/lib. If unsure you could add them all to the list prepending the lower case "l" to their names. For instance, if the library were called math, you'd add it by appending -lmath to the list. Just be cautious not to add multiple versions of the same library, say a debug version and a release version, at the same time, or you most certainly will get multiple reference linking errors.
Instead of manually specifying the libraries which should be linked to your binaries as suggested above, you also have the option to use pkg-config to do the hard work for you. This documentation for gstreamer states it suficies to add the following to the .pro file:
CONFIG += link_pkgconfig
PKGCONFIG += QtGStreamer-0.10
The drawback to this approach is naturally that you have to get pkg-config to work on your system first.

I find this works for me. It uses the environment variable set by the GStreamer install - so should work on other PCs. There is a different environment variable for 64 bit, but same principle.
QT += core gui
TARGET = GStreamerTest4
TEMPLATE = app
SOURCES += \
qt-videooverlay.cpp
HEADERS +=
FORMS +=
GstreamerDir=$$(GSTREAMER_1_0_ROOT_X86)
INCLUDEPATH = $${GstreamerDir}/include/gstreamer-1.0
INCLUDEPATH += $${GstreamerDir}/include/glib-2.0
INCLUDEPATH += $${GstreamerDir}/lib/glib-2.0/include
INCLUDEPATH += $${GstreamerDir}/lib/gstreamer-1.0/include
LIBS = $${GstreamerDir}/lib/gstreamer-1.0.lib
LIBS += $${GstreamerDir}/lib/*.lib
In addition, you need to make sure C:\gstreamer\1.0\x86\bin is on the path (control panel or you can set it in QtCreator).

I found that on windows you really can avoid pkg-config stuff bit than need to include everything is needed for gstreamer as libs and .h. But also you will need to include GTK. A good answer by Kei Naga provides the idea for qt in VS 2010 http://gstreamer-devel.966125.n4.nabble.com/Configure-Visual-Studio-2010-for-GStreamer-td3804989.html but if you transfer everything he wrote to .pro file it will also work (at least for me).
Here is the code of pro file:
INCLUDEPATH += C:/ ... /GStreamer/v0.10.6/sdk/include/gstreamer-0.10 \
C:/ ... /GTK/include/libxml2 \
C:/ ... /GTK/include/libglade-2.0 \
C:/ ... /GTK/lib/gtkglext-1.0/include \
C:/ ... /GTK/lib/glib-2.0/include \
C:/ ... /GTK/lib/gtk-2.0/include \
C:/ ... /GTK/include/gtkglext-1.0 \
C:/ ... /GTK/include/atk-1.0 \
C:/ ... /GTK/include/cairo \
C:/ ... /GTK/include/pango-1.0 \
C:/ ... /GTK/include/glib-2.0 \
C:/ ... /GTK/include/gtk-2.0 \
C:/ ... /GTK/include
LIBS += -LC:/ ... /GTK/lib -LC:/ ... /GStreamer/v0.10.6/sdk/lib -lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgtk-win32-2.0 -lgstinterfaces-0.10

Related

QtCreator Cannot open include file (Windows)

I am trying to compile a open source project on windows: https://github.com/francisengelmann/FabScan100
I am using QtCreator 2.7.0, Qt Qt5.0.2 msvc2010_opengl, MSVC2010
My direcotries look like this:
C:\
C:\libs\opencv-2.4.2\
C:\libs\pcl-1.6.0
C:\libs\Qt\Qt5.0.2
C:\fabscan\FabScan100-master
I modified the qtTest.pro file to include the neccessary headers and libs:
INCLUDEPATH += C:\libs\pcl-1.6.0\3rdParty\Eigen\include
LIBS += C:\libs\pcl-1.6.0\3rdParty\Eigen\bin
INCLUDEPATH += C:\libs\pcl-1.6.0\3rdParty\FLANN\include\flann
LIBS += C:\libs\pcl-1.6.0\3rdParty\FLANN\lib
INCLUDEPATH += C:\libs\pcl-1.6.0\3rdParty\Boost\include\boost
LIBS += C:\libs\pcl-1.6.0\3rdParty\Boost\lib
INCLUDEPATH += C:\libs\opencv-2.4.2\opencv\build\include
LIBS += C:\libs\opencv-2.4.2\opencv\build\x86\vc10\lib
INCLUDEPATH += C:\libs\pcl-1.6.0\include\pcl-1.6
LIBS += C:\libs\pcl-1.6.0\lib \
-lpcl_common \
-lpcl_io \
-lpcl_filters \
-lpcl_kdtree \
-lpcl_registration \
-lpcl_features \
-lpcl_segmentation \
-lpcl_surface \
-lpcl_search
But when I press the compile button QtCreator throws me an error:
..\qtTest\staticHeaders.h(4) : fatal error C1083: Cannot open include file: 'Eigen/Core': No such file or directory
Which is kind of strange because the file is actually there. I am also able to open it in QtCreator by pressing STRG & Clicking on the include statement in staticHeaders.h
Any ideas?
Based on the staticHeaders.h code (line 4), you need to have a folder called "Eigen" which contains the "Core" file. For instance, I have /usr/include/eigen2/Eigen/Core on Linux, in which case /usr/include/eigen2 has to be added to the INCLUDEPATH variable with qmake. Make sure you have C:\libs\pcl-1.6.0\3rdParty\Eigen\include.
Also, if it does not work in QtCreator as per your comment, you can always try to force explicitly to rerun qmake by the execute qmake option.

QtCreator and TBB under Windows

I have compiled TBB from source using Mingw following the comment #5 in this post: http://software.intel.com/en-us/forums/topic/291331. That went ok.
When I try to use the new TBB library in a QtCreator project, I end with this errors (ignore the warning messages): http://postimage.org/image/yrrecugix/
Here's the sample code I tried (I omit the non-tbb code):
#include "tbb/task_scheduler_init.h"
int main()
{
tbb::task_scheduler_init init;
/// more things.
}
And here's the .pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
#QMAKE_CXXFLAGS += -fopenmp
#QMAKE_LFLAGS += -fopenmp
INCLUDEPATH += "E:\TRABAJO\LIBRERIAS\tbb-4.1_src\include"
LIBS += -L"E:\TRABAJO\LIBRERIAS\tbb-4.1_src\build\windows_intel64_gcc_mingw4.5.4_debug\" \
-ltbb_debug
Any idea?.
Thanks!.
When built with MinGW on Windows, TBB binaries are tbb.dll and tbb_debug.dll. The option -ltbb_debug in your configuration files probably causes the linker to look for libtbb_debug.<something>. It can't find such a binary and reports about unresolved symbols.

OpenCV 2.4 : problems with includes in Qt in windows

I am not a C++ master (far from that actually), I try to setup an OpenCV + Qt project. I have downloaded the last release of OpenCV. I did nothing more with that (if I understand well, everything is pre-built, so I just have to add the path to the libs in my .pro file).
I added the path to the include folder /opencv/include
That should work that way, since the includes in cv.h, for example, are like that :
include "opencv2/core/core_c.h"
However, when I browse through my opencv folder, opencv2 is empty, there is no core folder in it, nor anything else, actually there is just a header file, opencv.h .
I noticed that all my include are spread into several folders, under the module folder... what should I do??
Thank you very much!
You have to add those libraries in .pro file module wise, means you have to add all modules you are using in the project to LIBS variable in .pro file. Say if you are using modules libopencv1, libopencv2, libopencv3
LIBS += -L/usr/lib -lopencv1 -lopencv2 -lopencv3
like that.
If opencv libraries are added to /usr/local/lib, use -L/usr/local/lib instead of -L/usr/lib
Here is my .pro file :
QT += core gui
TARGET = test_MTI880
TEMPLATE = app
SOURCES += ... ... ...
INCLUDEPATH += D:/PointGreyResearch/FlyCapture2/include \
+= D:/opencv/include
LIBS += D:/opencv/build/x86/vc10/lib/opencv_core240.lib \
D:/opencv/build/x86/vc10/lib/opencv_highgui240.lib \
D:/opencv/build/x86/vc10/lib/opencv_imgproc240.lib \
D:/opencv/build/x86/vc10/lib/opencv_objdetect240.lib \
D:/PointGreyResearch/FlyCapture2/lib/FlyCapture2.lib \
D:/PointGreyResearch/FlyCapture2/lib/C/FlyCapture2_C.lib \
D:/PointGreyResearch/FlyCapture2/lib/FlyCapture2d.lib \
D:/PointGreyResearch/FlyCapture2/lib/FC1/PGRFlyCapture.lib
OK I found the answer...
The right include folder is the one into the build folder ... -_-'

Compiling google test framework with Mingw compiler

I have a Qt project and i wanted to use google tests framework GoogleTestFramework in order to do google test. The framework compiled fine on Linux.
I have managed to compile the libraries on windows, using tips provided in the following link:
Installing Gtest without pthreads
The following advice do not let me compile the libraries, because of errors due to pthreads:
Sackoverflow compiling with MSYS
I have :
GNU Make 3.81 for make.exe
GNU Make 3.82 for mingw32-make
CMake 2.8.7
QT 4.7.4
Qt MingW gcc v 4.4.0
When i try to compile my test projet, i get an error saying:
undefined reference to '__chkstk_ms'
File not found: gtest-all.cc
Here is my qmake project code (I have semplified the code).
QT += core gui
DEPENDPATH += . headers src ../FastTrans/headers ../FastTrans/src ../FastTrans/forms C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/include
INCLUDEPATH += . headers src ../FastTrans/headers ../FastTrans/src ../FastTrans/forms C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/include
TARGET = tstall
#CONFIG += console
#CONFIG -= app_bundle
TEMPLATE = app
HEADERS += ../FastTrans/headers/shortcutsactionsitem.h \
../FastTrans/headers/shortcutsactionsmodel.h \
../FastTrans/headers/isavesettings.h
SOURCES += ../FastTrans/src/shortcutsactionsitem.cpp \
../FastTrans/src/shortcutsactionsmodel.cpp \
../FastTrans/src/isavesettings.cpp \
src/tstshortcutsactionsitem.cpp \
src/tstshortcutsactionmodel.cpp
INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/
win32: LIBS += C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/mybuid/libgtest.a
win32: LIBS += C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/mybuid/libgtest_main.a
Google recommends the following for compiling in Windows:
### Windows Requirements ###
* Microsoft Visual C++ 7.1 or newer
### Cygwin Requirements ###
* Cygwin 1.5.25-14 or newer
I've heard of some people using MingW for compiling this. Supposedly compiling with MingW can be a little faster because there doesn't need to be a comparability layer between the OS and the application.
But, since this is just for dev testing purposes Cygwin should suffice. Just download the version that Google recommends.
See Also:
Compile Cygwin project in Eclipse
How Cygwin compares to MingW for porting Linux applications to Windows

How can I force qtcreator to create non-universal binaries

When I use qtcreator on mac, it creates universal binaries.
Does anyone know how to set it so it just creates a 'native' binary? (So i386' in my case?)
Qtcreator uses qmake as a buildsystem.
Google hasn't been my friend so far, I hope stackoverflow will.
EDIT:
my config file so far:
TARGET = mongowriter
CONFIG += console
CONFIG -= app_bundle
CONFIG += x86
#CONFIG -= ppc
TEMPLATE = app
INCLUDEPATH += /opt/local/include/.
INCLUDEPATH += ../mongodb/.
SOURCES += main.cpp
LIBS += /usr/local/lib/libmongoclient.a
LIBS += /opt/local/lib/libboost_thread-mt.a
LIBS += /opt/local/lib/libboost_filesystem.a
LIBS += /opt/local/lib/libboost_program_options.a
It still gives the error on the libmongoclient.a
The libboost libraries are all ok, but this is because I got them from macports with the +universal option.
Since mongoclient doesn't support universal I'm currently removing all the universal stuff. I was hoping to get 3 errors for the boost libs and that at l;east mongoclient would link.
At that point I could redo the whole macport story again but this time with universal removed.
Unfortunately it seems it still builds a universal binary since I still have the same linker errors.
thanks for the help
you can use the 'CONFIG' variable in your project file to specify which plattforms shall be supported to create a universial binary you use
CONFIG += x86 ppc
if you only need x86 you use
CONFIG += x86

Resources