QtMultimedia inclusion in Windows and Linux - linux

I am using QtMultimedia module in my application. However, the following code, which passes in Windows, fails on ubuntu.
#include <QtMultimedia/QAbstractVideoSurface>
#include <QtMultimedia/QVideoFrame>
according to this question, QtMultimediaKit must be installed. However, the location of headers differ, and code that passes looks like:
#include <QtMultimediaKit/QAbstractVideoSurface>
#include <QtMultimediaKit/QVideoFrame>
It is admittedly a minor difference, but it prevents me from interchangeably compiling in Windows and ubuntu. My guess is, i should use some form of macro expression, in lines of:
#ifdef WIN_MACRO
#include <QtMultimedia/QAbstractVideoSurface>
#include <QtMultimedia/QVideoFrame>
#else
#include <QtMultimediaKit/QAbstractVideoSurface>
#include <QtMultimediaKit/QVideoFrame>
#endif
to make the code compile on both systems. If that is correct, what should the macro be? If not - how can the problem be solved?

There is a macro in the Qt libraries that should help you. Try:
#ifdef Q_OS_WIN

Related

Qt4 'usleep' was not declared in this scope in ubuntu 14.04

I'm using QtCreator 3.3.2 on Ubuntu 14.04(i386), and Qt4.8.6.
The problem is just like what the title said and with a similar error:
'sleep' was not declared in this scope.
And these are headers included.
#include <QMessageBox>
#include <QDateTime>
#include <QDir>
#include <QDate>
#include <QTime>
#include <QFileDialog>
#include <QTextStream>
#include <QStringList>
#include <QFile>
#include <QIODevice>
#include <QFileInfo>
#include <QtGlobal>
Weird thing is there were no problems when I used Ubuntu 12.04 and QtCreator2.4.1(Qt4.8.0);
You should use nanosleep which is available in #include <ctime>.
Also you might need to include unistd.h for sleep and so on which I do not recommend.
All I can think of is that in your previous installation these files were auto included or macro'd.
nanosleep or man nanosleep

implicit declaration of function 'create_proc_entry'

I'm trying to use the create_proc_entry() function to create a directory under /proc. When I try to compile the code, I get the following error: implicit declaration of function 'create_proc_entry' .
These are the headers I have included in my .c file:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
The kernel version on the machine I'm trying to compile for is: 3.10.33-g7954807-dirty
Am i missing any headers necessary to call this method? Or is the method deprecated in my version of the kernel?
/proc filesystem has been refactored in 3.10, the function you are looking for has been removed, you should use the full featured proc_create function family. Note that the signatures are different.
3.10 version:
http://lxr.free-electrons.com/source/include/linux/proc_fs.h?v=3.10
3.9 version:
http://lxr.free-electrons.com/source/include/linux/proc_fs.h?v=3.9
You can find greater explanation of using full featured /proc functions in the book Linux Device Drivers 4, or, if you want shorter solution, check this link (https://github.com/jesstess/ldd4/blob/master/scull/main.c) where you can see how the struct file_operations has been used. You do not have to setup to all fields of the struct.

compiling linux C++ in eclipse

I am trying to compile a c++ project.
I get an error that mutex.h is missing.
1) Where in linux in read hat all include are ?
2) Where do I include it in eclispe ?
Spasiva
You don't mention which type of mutex you are trying to use:
If it's the pthread mutex, then:
#include <pthread.h>
If it's the C++11 mutex, then:
#include <mutex>
(you'll also need to compile with -std=c++11).

visual c++ 2005 dll project and prerequisites needs to be installed on target machine

i wrote a simple dll and i included below header files:
#include <windows.h>
#include <sddl.h>
#include <winsock.h>
#include <stdio.h>
#include <stdlib.h>
#include <mprapi.h>
#include <raserror.h>
#include <mprerror.h>
#include <strsafe.h>
so my dll works fine in my computer but in another computer not working. i installed vcredist_x86 on target machine but nothing changed. i also used setup deploy wizard and nothing happend. but when i installed visual studio 2005 on target machine my dll works perfectly.
so here is the question, how can i retrieve which prerequisites needs to be installed on target machine?
also i must mention that i compiled my code as c code "Compile as C Code (/TC)".
sorry for my poor english and thanks for your helps in advance.

linux module compilng missed folder asm

I am trying to compile a driver. Version of my kernel is 3.2.0-27-generic.
I left only includes that I need:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/dmi.h>
These headers are found. But when I try to compile I get error that asm/cache.h file is not found.
When I dug dipper I found that there is no such folder as "asm", but asm-generic and it contains required headers.
It's structure of folder with headers:
Why was it renamed? Because of it I can't compile another drivers. If I rename "asm-geneic "to "asm" it will lead to other missing headers. What's wrong here?
asm/cache.h is architecture dependent, there are different asm directory for different architectures
arch/powerpc/include/asm/
arch/x86/include/asm/
arch/arm/include/asm
[...]
You can't rename include/asm-generic to include/asm because your problem is that you can't reach the architecture asm folder. Try to check your .config file or set manually the ARCH variable.

Resources