How to connect QT with VLC player - c++

In my QT GUI application I need playback some video files. I tried the MediaPlayer component (qtmultimedia 5.0), but it cannot read the video containers (mp4/mkv) that I'm using, which VLC player runs without any problem. So I found an library called vlc-qt (http://projects.tano.si/vlc-qt) and downloaded the windows binaries (which seem to be compiled using MSVC 11.0), but it fails to link on QT Creator MinGW (it shows 16 lines of undefined reference), maybe because vlc-qt is compiled with a different compiler than the one used to build the QT app.
I can't find any working references or documentation on this topic, so does anybody know how can I make this?
More details:
Windows 8.1 x64
QT Creator 3.0.1 | QT 5.2.1
vlc-qt 0.9.0
C++
Thank you.

The library is compiled using MSVC so it can not be liked to your application with a MinGW compiler. You can get the code from Here and compile it with MinGW compiler. After that you can link it to your app.
You can download and install CMake from Here. Next open the file named "CMakeLists.txt" from the root of the VLC_Qt source code with Qt Creator. Click "Next" and then after selecting the desired Generator click "Run CMake". WHen everything completes click finish. Now you can build the entire VLC-Qt with Qt Creator.

Related

Qmake on Windows

I have a project written in Qt that I have no problems compiling and running on Linux. The command line is:
qmake ../trunk/GSDTesting.pro
The process on Linux was really simple: install a few dependencies using apt and you are off.
My task is to recompile the same program on Windows using Visual Studio C++ compiler, but the problem is I don't know how to start. There is no such thing as qmake for Windows.
Can someone give me a few hints where to start. Please note that I don't know QT almost at all, my task is just to debug some issue unrelated to QT.
Are you using terminal exclusively on Windows? If so, maybe this image of example build steps straight from Qt Creater 4.14.2 may help you:
As you can see the image of the default Qt creator build steps list the file path where 'qmake.exe' can be located on a local installation of the toolchain.
If you can use a machine with a display I find using the Qt creator GUI is not all that bad.
Here is a link to the base get started page:
https://doc.qt.io/qt-5/gettingstarted.html
Here is a link to the installer download page:
https://www.qt.io/download
IMPORTANT:
You will need to make a Qt account, login to your account, and then download the open-source version of the API. The commercial version of the same source is acquired differently/seperately.
Otherwise, if you cannot use the GUI, can I request some clarification on why you cannot use Qt creator on your Windows installation?

Cannot run Qt Creator GUI outside of Qt. "The application was unable to start correctly (0xc000007b)" error

I downloaded C++ code from GitHub to tag images for training an object detector using Machine Learning.
Within Qt Creator 4.2.1 Based on Qt 5.8.0 (MSVC 2015, 32bit), I was able to compile and run the code. Unfortunately, I was not able to run the .exe outside of Qt Creator.
Initially, I received an error that
"The program can't start because libgcc_s_dw2-1.dll is missing".
Thanks to
QT The program can't start because libgcc_s_dw2-1.dll is missing, that was fixed easily by adding
"QMAKE_LFLAGS += -static"
to the .pro file. Now, when I run it I get
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
I was able to reproduce the error using the simple "Hello World" default project that appears when you create a Qt Widget Application. This led me to believe something was wrong with my installation.
Based on the advice of this article: https://stackoverflow.com/questions/12099117/32-bit-qt-application-on-win-7-x64-wont-run-but-runs-fine-from-qt-creator, I used Dependency Walker to identify possible causes. I expected to see only a few items that I can follow up on. Instead, I received a list of close to 100 missing .dll files. All the files started with
"API-MS-WIN ###.DLL" or "EXT-MS ###.DLL"
where ### represent some additional text characters, for example;
"API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL"
I'm attaching a sample output.
Another suggestion was to copy over
libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll.
That did not work either.
My next move was to simply get the latest version of QT and wish for the best. I installed Qt Creator 4.8.1 Based on At 5.12.0 (MSVC 2015, 32 bit). This time, I could not even get the code to run in the IDE. I received 1000+ error messages!
Based on advice from several pages, I added
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
to the .pro file and it still would not compile.
Also, I verified that the application is being built as a 32bit application. I'm running on a 64 bit Windows 10 system.
If anyone would like to take a crack at it to see if they can create a working .exe, here is the link: github.com/clavicule/BBTag
Qt provides a tool to copy the necessary dlls to the folder of your executable.
The tools is called windeployqt.exe and comes with your Qt installation. For me it is located at C:\Qt\5.9.1\msvc2015_64\bin\windeployqt.exe. You will have to look at your installation path and probably the msvc_32 folder to find it.
Then you go to the folder with your executable in it, oben a command prompt or powershell and execute path\to\windeployqt.exe yourProgram.exe and it will automatically copy the necessary dll files to this folder. Afterwards you can run your program without issues.
The official documentation for the tool can be found here.
Alternative 1: While developing you could use QtCreator which automatically adds the paths to the dlls when running your program - make sure to include them if you deploy your program!
Alternative 2: Add the path to the necessary dlls to your PATH variable. This isn't recommended either, since everyone who gets your program would have to do the same to run it.
I figured it out! My installation of Anaconda (a Python distribution popular for data science and machine learning) is the culprit.
From: #remy-lebeau
The application was unable to start correctly (0xc000007b)
The error:
"The application was unable to start correctly (0xc000007b) ..."
is a good indicator that the 32-bit app tried to load a 64-bit DLL. At first, this did not make sense since I verified many times that I was using the 32 bit version of Qt.
It turns out that the installation of the 64 bit version of Anaconda also contained many Qt5 dlls used for the PyQt5 package. Since the path to this folder came before the path to my c:\Qt...\bin folder, it was used in the build instead of the actual 32 bit version installed with Qt. This was not obvious because I was unaware of PyQt5 so I had no idea that it came with Anaconda. A simple reordering of the path entries using the System Environment Variables interface AND a system restart fixed the problem.
Silver lining: I now know C++ and designing GUIs w/ QT and PyQt5
Thanks #albertmand and #jwernerny

No QAudioDeviceInfo::availableDevices on Windows

I'm using Visual Studio 2015 Community to make a Qt-based GUI in C++ which includes a microphone input. I'm testing the microphone part, and am looping through QAudioDeviceInfo::AvailableDevices(QAudio::Mode::AudioInput) (and AudioOutput for that matter) and nothing is coming up. I've checked that my project includes QtMultimedia, and I definitely have audio devices on this computer. I'm stuck with an existing compiled Qt (since this application is plugging into another project), but I've verified that the Qt install has the QtMultimedia and the Windows audio plugins. The Qt version is 5.9.3.
The only thing I can think of is that the project isn't including the right plugin, but I don't know how to change that.
The issue was that I needed to run "windeployqt" on the built executable to get all of the plugins into the right place. I'm curious why it didn't work without that, but that's a VS + Qt plugin problem, not a Qt problem.

Missing compiler in Qt Creator

I recently installed Qt creator 2.8.1 online on my win Vista 32 bit machine.
To start with Qt I wrote simple pushbutton code. And when I tried to build it shows error message saying
Qt Creator needs compiler set up to build. Configure a compiler in kit
option
I tried with that Kit option din't work. what do I do?
PS Thank You
Simply refer to MINGW online install available at Qt's official downloads( http://download.qt-project.org/). You need not do anything. It will automatically detect an kits and will compile successfully.

Developing QT applications in Xcode?

My IDE of choice for the Mac (at least for C++ and Objective-C development) is Xcode. I have a 64-bit Intel Mac with OS X Lion installed, and Xcode version 4.2 downloaded from the Mac App Store.
My problem is that Qt is apparently not compatible with Xcode 4 (it crashes when launching projects generated by qmake), so I'm basically asking how I can integrate Qt with Xcode. I don't have to be able to run and debug the project from Xcode, just build it.
So I thought it might be a solution to use qmake as an external build system within Xcode, the problem is that I have no idea how to set up qmake as my build system, so that I can develop my Qt applications in Xcode 4.
Please help me! :)
Google shows up many pages, but this Qt4 with Xcode page appeared at first glance to be a fairly definitive resource. However, it was last changed in 2006.
Please check out: http://qt-project.org/doc/qt-5/macosx.html
There is a much more recent Qt Developer Network forum post that seems to have good info in it. Specifically, this reply from August 19, 2011 gives a complete recipe.
Update 25/05/2016:
The first two links are now dead, and not archived due to robots.txt.
However, I've updated the link to the forum post.
And here's a copy of emiguel's answer. It is now 5 years old, so I don't know how current it still is.
Hi,
To solve my problem I did the following.
First I`m going to have a subproject in Qt that mantains the graphical interface, I created this project as a C++ library, so I could include this in the main project.
The main project is a C++ project in Xcode (which is a plugin template with a lot of configurations).
Second, I ported the Qt project to Xcode using the spec macx-xcode parameter.
Third, having both projects in Xcode, I can attatch the library (in Qt) to the main project. To do this, right click in the xcode project and click in the "existing file..." option, select the xcodeproj file from the Qt project. Finally add the library to the linkage phase, this is done by dragging the lib file, wich is under the xcodeproj file, to the "Targets" section in the "Link binary with Libraries".
Fourth, import the Qt framewoks to the main project, to do that, right click in the main project, click in add a existing framework, select the Qt features used by the project (ex. QtSDK/lib/QtCore.framework)
And finally, add the header and library paths in the main project. Click in project menu->project settings, set the header search paths option with the Qt headers (ex QtSDK/include//) and the library search paths (ex QtSDK/lib//**).
That's all, now I can instantiate my own Qt widgets from the C++ project.
Note: I have to do an additional step because my target was i386 and the downloaded Qt version were 64 bit, so I downloaded the sources and compiled it for i386.
Now I have another problems about drawing inner the plugin... but I think that will be for another post.
Thanks a lot for your help
Finally, current information on building Qt in Xcode is available in Qt for OS X - which is too long to copy here, and will be maintained and updated by Qt...