Trying to build project on newly installed Qt that runs on Centos 64 bit. Got error:
/home/me/pro/LoggingCategories.h:4: error: QLoggingCategory.h: No such file or directory
#include <QLoggingCategory.h>
^
Why it is missing? I suppose it should be installed as default. How to fix error?
UPD
Got the same error after changing #include <QLoggingCategory.h> to #include <QLoggingCategory>
/home/me/pro/LoggingCategories.h:4: error: QLoggingCategory: No such file or directory
#include <QLoggingCategory>
^
Related
I have built a Qt toolchain using Yocto. I installed it and set the environment variables running the script generated by Yocto.
I open QtCreator and configure my cross-compiler kit following these instructions.
I'm unable to build this:
#include <QApplication>
#include <QPushButton>
int main(int argc, char **argv)
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
hello.show();
return a.exec();
}
Getting this error:
(.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag'
So I try to build this instead:
#include <stdio.h>
int main()
{
printf("Hello world!\n");
return 0;
}
It's ok. But when I deploy to my target and try to run it can't because it hasn't been compiled for target architecture (arm).
helloworld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ldd
There is also this warning which could be very indicative:
:-1: warning: "/usr/bin/gcc" is used by qmake, but "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc" is configured in the kit.
Please update your kit or choose a mkspec for qmake that matches your target environment better.
I tried to set mkspec on my kit configuration but the result it's the same.
Solved. Maybe I "lied" about saying that setting the mkspec manually it wasn't working neither. That's not true, it does. It's just I was having another issues and couldn't test it properly. The problem was mkspec it wasn't the right. It was pointing to linux-g++ and I fixed it pointing to the proper mkspec. Anyway Qt cretator is telling me that he can't find it! so it's that a bug? The first issue (compiling GUI) was solved too thanks to this.
I'm trying to test a library for an DHT22 "Temperature Sensor", but I got an error while including an internal arduino library from the DHT.cpp file
I got this error:
C:\Program Files (x86)\Arduino\libraries\DHT\DHT22.cpp:56:20:
fatal error: avr/io.h: No such file or directory #include <avr/io.h>
In the DHT22.cpp, this is the the block of error
extern "C" {
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
}
I got in the conclusion that the library is not finding the avr folder which is
in C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr I checked another built-in library servo.cpp and this is the include part
#include <avr/interrupt.h>
#include <Arduino.h>
but the last one works without errors, my question is why the DHT library is not importing the required files and the servo does ?
It looks like you are using some old version of the library (from 2012).
The latest version, which does not contain the problematic "extern" block, can be found here:
https://github.com/adafruit/DHT-sensor-library
(The default example works nicely with my Arduino Nano v3.0 and DHT22 sensor)
I'm trying to install the SDL library for Qt 5.1 on Windows 7, but I'm stuck. I'm a total newbie with using external libraries so please bear with me, I figured this sort of thing would be pretty basic to set up.
I downloaded the SDL-devel-1.2.15-mingw32.tar.gz (Mingw32) file, extracted it, and in my project's PRO file I added:
INCLUDEPATH += "C:\SDL\SDL-1.2.15\include\SDL"
LIBS += "C:\SDL\SDL-1.2.15\bin\SDL.dll"
Now when I try to compile this:
#include <iostream>
#include <stdlib.h>
#include "SDL.h"
using namespace std;
int main()
{
SDL_Init( SDL_INIT_EVERYTHING );
cout << "Hello World!" << endl;
return 0;
}
I get this:
crt0_c.c:-1: error: undefined reference to `WinMain#16'
collect2.exe:-1: error: error: ld returned 1 exit status
Compiling with SDL and g++ cannot find -lSDLmain etc
Undefined reference to WinMain#16 when using SDL
I am sure one of those is also applicable to your question.
SDL should be prevented from overloading main method. To do so, add the following piece of code wherever you include SDL headers.
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#ifdef __MINGW32__
#undef main /* Prevents SDL from overriding main() */
#endif
To make it working in your case, your project.pro file should be like this:
LIBS += -LC:\SDL-devel-1.2.15-mingw32\SDL-1.2.15\lib -llibSDL
INCLUDEPATH +=C:\SDL-devel-1.2.15-mingw32\SDL-1.2.15\include
As it is eveident from my code, I am using sdl version 1.2.15, 32-bit for mingw compiler on Windows 8.
Reference:
To find a good tutorial about the SDL ffmpeg integration, you can refer to dranger.
I am trying to compile this. I am using the AMD SDK. I am using the header files that come with the aforementioned SDK and they are located in:
C:\Program Files (x86)\AMD APP\include\CL
The tutorial states:
Header files
Just like any other external API used in C++, you must include a header file when using the OpenCLâ„¢ API. Usually, this is in the directory CL within the primary include directory. For the C++ bindings we have (replace the straight C API with cl.h):
I found that last bit a little confusing. I am using both .h and .hpp
#include <CL/cl.h> when this is used it will compile the checkErr function
#include <CL/cl.hpp> when this is used it gives me access to the cl namespace
When I try to compile this code it fails with:
'clUnloadCompiler': was declared deprecated
ADDITIONAL DETAILS (after removing #include <CL/c.h>)
It now gives the following list of errors:
error C4996: Error 2 error LNK2019: unresolved external symbol _clReleaseCommandQueue#4 referenced in function "public: static int __cdecl cl::detail::ReferenceHandler<struct _cl_command_queue *>::release(struct _cl_command_queue *)" (?release#?$ReferenceHandler#PAU_cl_command_queue###detail#cl##SAHPAU_cl_command_queue###Z)
error LNK2019: unresolved external symbol _clReleaseContext#4 referenced in function "public: static int __cdecl cl::detail::ReferenceHandler<struct _cl_context *>::release(struct _cl_context *)" (?release#?$ReferenceHandler#PAU_cl_context###detail#cl##SAHPAU_cl_context###Z)
In properties for my project I have:
added C:\Program Files (x86)\AMD APP\include\ as an additional include directory
added C:\Program Files (x86)\AMD APP\lib\x86_64 as an additional library directory
added OpenCL.lib as an additional dependency
The errors I listed happen regardless of whether or not I take the last two steps. That is, the last two do not seem to be helping or harming anything
Summary of answers I provided in comments:
For a C++ application, you only need to #include <CL/cl.hpp>
Make sure you are linking with the correct OpenCL.lib (32-bit vs. 64-bit).
That's because clUnloadCompiler() was deprecated in OpenCL 1.2.
Add
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
to your code before
#include <CL/cl.h>
#include <CL/cl.hpp>
I wrote a sample program using QSqlDatabase object two years ago with a Qt configuration that depended on static libraries. It compiled ran as expected. Some time last year, I rebuilt the configuration using shared libraries and now I am getting the following errors.
Here is the error:
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) publ
ic: __thiscall QSqlDatabase::~QSqlDatabase(void)" (__imp_??1QSqlDatabase##QAE#XZ
) referenced in function _main
...
debug\qtsql.exe : fatal error LNK1120: 12 unresolved externals
Here are my includes and the instantiation of the object in main.cpp:
#include <Qt>
#include <QtDebug>
#include <QtSql\QSqlDatabase>
#include <QFile>
#include <QtSql\QSqlQuery>
#include <QString>
#include <QVariant>
#include <QDate>
int main()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
...
Also, here is my .pro file:
TEMPLATE = app
TARGET =
DEPENDPATH += . versions
INCLUDEPATH += .
# Input
SOURCES += main.cpp
# Libraries
QMAKE_LIB_DIR += C:\\Qt\\4.7.0\\lib
I thought that last line in the .pro file would give me a link to any library I might need in Qt. I'm pretty ignorant of what it takes to link to the Qt .dll's.
What am I missing to get the program to see the QSqlDatabase library?
Also, must I specify the library even though I have given it the header file and library directory?
CONFIG += qt
QT += sql
might be missing here (link to qmake docs)
Here is a link to the Qt sql examples. Perhaps you find inspiration/guidance there.