qprinter not found in C++ - c++

This is a very basic question. I have searched the history of the of this forum and not found anything directly applicable to this app in C/C++.
I am building the code on Fedora20. I have the following libraries, installed using yum:
qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel
qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel
[root#localhost subsurface]# qmake-qt5 --version
QMake version 3.0
Using Qt version 5.4.0 in /usr/lib64
I use qmake like this:
make-qt5
No errors displayed, I assume make file ok and header files generated are ok.
Upon make, the following Qt-related errors:
[root#localhost subsurface]# make
(1)
compiling main.cpp
In file included from /usr/include/QtGui/QTextEdit:1:0,
from .uic/ui_mainwindow.h:26,
from qt-ui/mainwindow.h:14,
from main.cpp:11:
/usr/include/QtGui/qtextedit.h:235:16: error: ‘QPrinter’ has not been declared
void print(QPrinter *printer) const;
^
(2)
In file included from qt-ui/tableview.h:10:0,
from .uic/ui_diveplanner.h:26,
from qt-ui/diveplanner.h:140,
from .uic/ui_mainwindow.h:30,
from qt-ui/mainwindow.h:14,
from main.cpp:11:
.uic/ui_tableview.h: In member function ‘void Ui_TableView::retranslateUi(QGroupBox*)’:
.uic/ui_tableview.h:49:87: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
TableView->setWindowTitle(QApplication::translate("TableView", "GroupBox", 0, QApplication::UnicodeUTF8));
I suspect I am missing one or two more Qt libraries. Which library files contain QPrinter and UnicodeUTF8?
Any advice, please?
Kind regards,
willem

This worked for me on PacketSender-2.0 project
# yum remove qt-devel
# yum install qt5-qtbase-devel -y
$ make clean
$ qmake-qt5
$ make

Related

How do i compile and use mariadb c++ Connector library in debian 10?

Setup: Beagleboneblack, debian10, arm, mariadb v10.3.36.
Following this guide: https://mariadb.com/docs/connect/programming-languages/cpp/install/
I reach this step:
$ sudo install include/mariadb/* /usr/include/mariadb/
when executing the above command I get the following message; install: omitting directory 'include/mariadb/conncpp'
I ran through the rest of the Install MariaDB Connector/C++
guide, but when i try to compile my task.cpp app using:
$ g++ -o tasks tasks.cpp -std=c++11 -lmariadbcpp
following this example: https://mariadb.com/docs/connect/programming-languages/cpp/sample-app/ i get:
# g++ -o tasks task.cpp -std=c++11 -lmariadbcpp
task.cpp:3:10: fatal error: mariadb/conncpp.hpp: No such file or directory
#include <mariadb/conncpp.hpp>
The main issue is with the -lmariadbcpp i think, its not installed in the correct place or whatever. Can someone explain to me how mariadb connector-library is installed, where it resides, and how i can use it when compiling?
It might be i can't use the c++ connector with my version of mariadb, since c++ connector requires that its a "enterprise" version of maria db. However it should be able to compile/install. Please help me understand the installation process of a library in debian? ?? :)
Update:
After some struggle, it seems i can install the files by cd into the include directories and installing the files manually be explicitly using the file name. Atleast i think there is some progress now...

Fatal Error: 'openssl/conf.h' file not found

I'm using a compiler to try to make a set of files I've been given and the line #include breaks with the error: Fatal Error: 'openssl/conf.h' file not found.
I've already installed openssl using brew, but it doesn't seem to work. Do I need to somehow connect openssl with my folder that I'm working in?
I'm on the newest mac OS sierra.
Running:
brew info openssl
gives the solution :
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

gcc returns "No such file or directory"

I'm trying to install Mathtex on my Ubuntu 16.04 server for my engineering wiki. It has been a nightmare, just as it was in the past when I tried this.
First, I've installed mathtex via apt-get. That complains of a missing directory. After manually creating those directory it moves on to complain of another. Finally complains of a missing cache directory. I create the cache just like the others and mathtex still complains that the cache directory is missing...
Then I attempt to install via the instructions on the website (http://www.forkosh.com/mathtex.html). In other words, install the dependencies LaTeX and dvipng. Then compile the program using cc (although I use gcc). I've gotten this to work in previous installations of Ubuntu - 12.04 or 14.04 - but can't find those instructions anymore. I was paying for a service until this summer when they went out of business.
Here is the compile line:
cc mathtex.c –DLATEX=\"$(which latex)\" –DDVIPNG=\"$(which dvipng)\" –o mathtex.cgi
Here is the return:
cc: error: –DLATEX="/usr/bin/latex": No such file or directory
cc: error: –DDVIPNG="/usr/bin/dvipng": No such file or directory
cc: error: –o: No such file or directory
I've also tried replacing $(which latex) with $(which pdftex) (/usr/bin/latex is a symbolic link to /usr/bin/pdftex) and /usr/bin/pdftex, /usr/bin/tex, /usr/bin, and /usr/bin/. Same result, the error says there is no such file or directory for all of them.
Googling this error only returns help for people who can't get Ubuntu to recognize gcc as the cc compiler. That's not my issue though.
Did you copy that command from a document? You have the wrong kind of dashes on your options.
Delete the – (en dash) and replace it with -.

g++ 4.6 issue no <bits/c++config.h> file as required by the header cstring

There is no file called bits/c++config.h in the c++ include directory which is required by the cstring header file. But when I include the the header cstring and compile with g++, it does not give me error. The problem occurred when I tried to compile the program with clang++ compiler in the following way.
$clang++ -cc1 -I/usr/include -I/usr/include/c++/4.6.1 -I/usr/lib/gcc/i686-linux-gnu/4.6.1 -I/usr/include/i386-linux-gnu -I opt_149739_build/include hello.cpp
In file included from /media/space/hello.cpp:2:
In file included from /media/space/opt_149739_build/include/clang/Driver/Driver.h:13:
In file included from /media/space/opt_149739_build/include/clang/Basic/Diagnostic.h:17:
In file included from /media/space/opt_149739_build/include/clang/Basic/DiagnosticIDs.h:18:
In file included from /media/space/opt_149739_build/include/llvm/ADT/StringRef.h:14:
/usr/include/c++/4.6.1/cstring:42:10: fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
I am using g++ 4.6.1 on Ubuntu 11.04
What went wrong?
The file bits/c++config.h is the platform specific include relative to the current compiler, so it is hidden in another directory, searched by default by g++, but not by clang++, as it seems.
In my machine, running locate c++config.h gives the following (relevant) files:
/usr/include/c++/4.6/i686-linux-gnu/64/bits/c++config.h
/usr/include/c++/4.6/i686-linux-gnu/bits/c++config.h
The first one is for 64-bits and the second one for 32-bits.
So just add -I/usr/include/c++/4.6/i686-linux-gnu or -I/usr/include/c++/4.6/i686-linux-gnu/64 or whatever you need for your platform.
Ran into the same problem while cross-compiling, the problem was solved after installing libstdc++-10-dev for arm. If you are not cross-compiling then you can try installing latest libstdc++ pkg.
sudo apt-get update
sudo apt-get install libstdc++-10
Then you may run into a header error: ' asm/errno.h' file not found. Just install gcc-multilib for this.
sudo apt install gcc-multilib
It can be related to how clang++ search its headers files.
You'll find a sample patch of how they fix it for fedora 15, 4 months ago, here.
See this red hat bugzilla post for more info.

GLIBCXX not found when compiling vtk example under mex

I have been trying to follow this example for compiling vtk in MATLAB using mex, on an Ubuntu 11.10. The mex command I used is as follows:
mex -I/usr/include/vtk-5.6 vtk_file.cpp -L/usr/lib/ -lvtkFiltering -lvtkRendering -lvtkCommon
After compilation I have a .mexa64 file.
However, when I try to run the file I end up with the following error:
Invalid MEX-file '/home/bill/Documents/MATLAB/vtk/vtk_file.mexa64':
/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.11' not found (required by /usr/lib/libvtkFiltering.so.5.6)
How can I ensure that glibcxx is found? I would have assumed that it would be included by default in the compilation.
Matlab uses its own glibc librarires, and it's often a big mess because of that.
To solve that problem you should first try to ensure that matlab use a supported version of gcc. Do you get a warning about that when you compile?
If you are sudoer, you can also "force" matlab to use the standard glibc, by doing something like that (I did it, and it works fine):
cd /usr/local/MATLAB/R2011a/sys/os/glnxa64
sudo mkdir old
sudo mv libstdc++.so.6* old
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
Many people complain about that on the internet, there are different solutions, if those two ones don't work.