Qt - qstring.h include string error - c++

I am an admitted noob when it comes to Qt and compiling on linux, so forgive me if this is a simple mistake.
I am attempting to compile a program on Ubuntu 14.04 LTS using:
qmake myprogram.pro && make
This application uses Qt4. I am getting a strange error that appears to originate in Qt itself.
In file included from /usr/include/qt4/QtCore/qobject.h:48:0,
from /usr/include/qt4/QtCore/qiodevice.h:46,
from /usr/include/qt4/QtCore/QIODevice:1,
from src/qt/fervor/quazip/zip.c:22:
/usr/include/qt4/QtCore/qstring.h:54:20: fatal error: string: No such file or directory
# include <string>
^
I am guessing this is an environment issue rather than an issue with my program. I have poked around the web and some people have suggested c++ build essentials aren't installed. I have verified the Ubuntu build-essentials package is installed.
Thanks in advance!
EDIT
So I went into the core qt header file, qstring.h, and found a constant that needed to be defined for my environment (QT_NO_STL). When I define that, I get a new error:
In file included from /usr/include/qt4/QtCore/qlist.h:45:0,
from /usr/include/qt4/QtCore/qobject.h:50,
from /usr/include/qt4/QtCore/qiodevice.h:46,
from /usr/include/qt4/QtCore/QIODevice:1,
from src/qt/fervor/quazip/zip.c:14:
/usr/include/qt4/QtCore/qiterator.h:50:79: fatal error: new: No such file or directory
# include <new>

The credit really belongs to #KubaOber, but in the interest of helping others I am posting the answer that solved my problem.
Turns out that I added a dependency (library) and didn't re-create the .pro file with qmake -project.
Thanks!

In my case it worked by just adding the following in the <project>.pro file:
CONFIG += qt
OR add instead:
CONFIG += qt
QT += svg

Related

How to use NetworKit as a library in OMNeT++?

I am trying to build the C++ Core of NetworKit and I would like to use it as a library in OMNeT++. I followed the instructions from the README file to build the code with cmake and make all. Then, I tried to follow the instructions from the Use NetworKit as a library section, but the examples presented there are not consistent with the source code. In particular, the directory NetworKit/graph does not contain the Graph.h file. There is a Graph.hpp file, but in another directory. Also, the LibDemo.cpp file is missing. Is the README file outdated or I am missing something here?
EDIT
This is an update to my post above. Apparently the README file is not up to date. In any case, I built the C++ Core of NetworKit. I included the library in my OMNeT++ application as follows:
#include <graph/Graph.hpp>
In OMNeT++, in my project Properties | OMNeT++ | Makemake, and then selecting src | Options | Custom, I added the following:
INCLUDE_PATH += -I/path/to/networkit/include/networkit
LIBS += -L/path/to/networkit/build_lib -lnetworkit
When I build my OMNeT++ project, I get the following error:
/path/to/networkit/include/networkit/graph/../Globals.hpp:42:14: error: expected unqualified-id
const double PI = 2.0*std::acos(0);
^
/path/to/omnetpp-5.4.1/include/omnetpp/simkerneldefs.h:47:19: note: expanded from macro 'PI'
#define PI 3.141592653589793
^
Can anyone help me with this? Thank you in advance!
You're correct, the documentation is out of date, LibDemo.cpp was deleted here: https://github.com/kit-parco/networkit/commit/a5b2c1f0c9336e783c8fb0cd956326d960451914
If you want an older version where this part of the doc is still valid, that would be version 4.2 which is the last version with this file. Somebody made a clone of that version here for some reason: https://github.com/SharafMohamed/NetworKit

QT missing binary operator before token "(" Error

I am using QT 5.7.1 and trying to build this experimental project.
But when i try to build, i get this error in qchar.h file:
D:/QT2/5.7/mingw53_32/include/QtCore/qchar.h:333:24: error: missing binary operator before token "("
#if QT_DEPRECATED_SINCE(5, 3)
There is only one version of QT is installed right now, and i controlled the file path of qchar.h. It is in QTCore folder. I tried google search based solutions but i could not build.
I have been googling for 2 days now, no solutions yet. I appreciate if anyone helps.
I found that file "signal.h" hides a file in QT include directory. I renamed the "signal.h" file to "QRPsignal.h" and solved the problem.
Also, when you rename "signal.h" file (of QRadioPredict) using QT, QT renames original include file in its own directory too. You should rename again the original file (of QT) to "signal.h".
In case anyone trying to build QRadioPredict on Windows, should keep this in mind.
Thank you for your suggestions.

missing include from v4l2, linux vs uapi/linux

I'm learning the v4l2 API for configuring video devices through v4l2-ctl. The code samples from ages ago are really out of date and some of the defines don't work anymore. There is a new method of requesting everything for the API from the kerhel which is shown in v4l2-utils. I'm trying to incorporate some of the code from v4l2-utils into my code. However, I'm getting an error from the compiler:
camera.hpp:1038:8: error: 'struct v4l2_ext_controls' has no member named 'which'
ctrls.which = V4L2_CTRL_ID2WHICH(qctrl.id);
And:
camera.hpp:1038:43: error: 'V4L2_CTRL_ID2WHICH' was not declared in this scope
ctrls.which = V4L2_CTRL_ID2WHICH(qctrl.id);
The field and define are in a file located in the linux source tree: /usr/src/linux-4.6.3-gentoo/include/uapi/linux/videodev2.h, but that file is not included when I specify:
#include <linux/videodev2.h>
What is the voodoo to get the compiler to include the correct file?
I've been studying the v4l2-utils source but can't figure it out.
Thanks much.
The file located in /usr/include was out of date. I had the headers installed for kernel 4.3 and needed the ones from a later version. The solution for my gentoo install was to add a keyword for sys-kernel/linux-headers and install the latest headers (4.7).
It turns out that the UAPI file becomes the headers when installed into /usr/include. I could probably have accomplished this with make headers_install in my /usr/src/linux directory as well, but I'm not sure whether that is more "correct" than installing the linux-headers ebuild. I worry about conflicts.
Hope this helps someone else...

Compiling C++ file with CMAKE (Unrecognized '-rdynamic')

I am trying to add a single C++ file to a working CMAKE project.
The project is building fine when I only have C files in the project. However, as soon as I add a cpp file to the ADD_EXECUTABLE section of CMakeLists.txt I get the following error: arm-none-eabi-gcc: error: unrecognized command line option '-rdynamic'.
Does anyone have any idea what might be going on here? Or what I could do to fix it?
Thanks so much for the help!
PS - I have a section at the top of the CMakeLists.txt that says SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # get rid of -rdynamic, but it doesn't seem to be doing that.
Check the armgcc.cmake (or equivalent). I found a field there named CMAKE_SYSTEM_NAME and CMAKE_SYSTEM. These need to be renamed to 'Generic'. This took care of the problem for me.

using CUTE in Eclipse: fatal error: boost/type_traits/is_integral.hpp: No such file or directory

I'm a absolute newbie in Eclipse at least when it comes to using C++. Now I've found this Plugin for testing and followed the "instructions" (yeah well i created a cute project). When i try to build the sample Project i get the following error:
fatal error: boost/type_traits/is_integral.hpp: No such file or directory
the faliure is in file cute_determine_traits.h in the Project/cute directory where all of CUTE's includes are. The line it the program crashe is this one:
#include <boost/type_traits/is_integral.hpp>
Actually i don't have any idea what I'm supposed to do.. I'd be very very happy for some easy instructions how to fix this! I'm using Eclipse c++.
UPDATE:
Okay, I found the issue. I installed boost the wrong way. It worked as soon as i ran the bootstrap.bat using mingw. I followed this Video http://www.youtube.com/watch?v=qDVRrSzsqco and then my includes worked.
Thanks everybody! :)
Geetings.
I had the same problem minutes ago. I realized I haven't install boost library when I was installing cute plug-in (boost can be found when you go to Help->Install New Software... and once you write the address http://www.cute-test.com/updatesite in "Work with" then choose CUTE Optional Features->Boost For CUTE).
Or maybe i haven't choosen the "Copy Boost headers into project" option... Anyways, I think both can solved your issue too.
Farewell!