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
Related
I'm learning to create kernel modules on Raspbian Jessie based on The Linux Kernel Module Programming Guide
Currently I'm on hello-5.c part. I tried to add static u8 myByte = 'X'; but u8 is not recognized. Then I changed u8 with uint8_t which is the same thing AFAIK and uint8_t is recognized as a data-type.
The older version of the tutorial here stated static u8 myByte = 'X';, so I want to reuse it with the newer tutorial.
The older tutorial included these:
#define MODULE
#define LINUX
#define __KERNEL__
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
While the newer tutorial included these;
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/stat.h>
I've tried using the old one, but the define part generates errors, so I used the newer tutorial.
So, why uint8_t can be recognized while u8 cannot in the newer version?
Because u8 is not a standard type, while uint8_t is (typedef'd in C99 and later <stdint.h>). If you want to use u8, include a header with an appropriate typedef, or typedef it in your code.
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).
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
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.
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.