getting Boost working in centos 5.5 - c++

This sounds like it should be simple, but it is proving to be impossible to accomplish.
I installed with the following command:
sudo yum install boost boost-devel boost-doc
Then, I started to added the following to my header file
#include <boost/filesystem.hpp>
and I promptly got the following error:
error: boost/filesystem.hpp: No such file or directory
I know that boost is partially working because when I use this header:
#include <boost/lambda/lambda.hpp>
i don't get compilation issues.
I know that I need to somehow build certain libraries like filesystem
However, I have not been able to find instructions anywhere on the entire internet for how to do this for CentOS 5. There is no bootstrap.sh or ./bjam for me to use.

I just looked at the RHEL 5.5 RPM for boost-devel, and it is missing /usr/include/boost/filesystem.hpp. The RPMs have Boost 1.33.1, and that version did not have boost/filesystem.hpp in it. You should upgrade to a newer version of Boost or write your code using the documentation for Boost 1.33.1 (available at http://www.boost.org/doc/libs/1_33_1/libs/filesystem/doc/index.htm).

Related

KDevelop include QtGui not found

I'm trying to learn how to use KDevelop on my Ubuntu 16.04 to write C++ code, and I installed it by doing this
sudo apt-get update
sudo apt-get install kdevelop
but after it is done installing and I'm trying to make a new project, and the lines at the top that says
#include <QtGui/QApplication>
and
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QAction>
are all returning errors saying that the included files are not found? And ask me to add a custom include path. I checked my KDevelop version on the terminal and it says I have Qt, or at least I think that's what it meant.
~$ kdevelop --version
Qt: 4.8.7
KDE Development Platform: 4.14.16
KDevelop: 4.7.3
But then when I run
~$dpkg --list libqt4-dev
~$dpkg --list libqt4-core
~$dpkg --list libqt4-gui
and it says none of them are installed. I'm so confused. Do I have the right Qt or not? How do I get KDevelop to find the correct Qt path? Should I maybe just install all the libqt4-whatever and try again?
Remember to distinguish between libraries that allow you to run a software and developer versions that allow to build new sotfware. Output of kdevelop --version states versions of the libraries which are used to run the application. In your system you are missing qttools5-dev with its dependencies.
By the way, maybe you will try qtCreator? It is an IDE developed by Qt team, and if you install it just by apt install qtcreator than you will have all necessary dev libs.

Expected type-specifier before 'QSslSocket' in QT Application

I am still fairly new to Qt, but I'd like to write a program that allows a user to send a small message via email.
When I go to build my project I get errors like
expected type-specifier before 'QSslSocket' and 'QSslSocket' was not declared in this scope. I get these both when I try to compile my code and when I try to compile the demos from the git, so I don't think it is in my code.
Looking into this issue I have seen that most solutions involve making sure that openssl is installed on the machine and that Qt was built with the openssl flag set in the configuration. I have ensured that I have openssl and libssl-dev installed and I just rebuilt my version of Qt using the openssl flag. Still no luck.
In my project I have QT += core network added in my .pro file. I have #include <QtNetwork/QsslSocket> in my *.h file that requires it.
As for my system, I am working on Ubuntu 14.04 LTS. I have Qt 4.8.6 installed (again with -openssl included in the config file). Openssl and libssl-dev are both at 1.0.1f-1ubuntu2.11.
If you have any ideas they would be greatly appreciated!
Ultimately, it did come down to my configuration. I completely removed all versions of Qt4 off my computersudo make uninstall (since I installed from a tarball instead of from the repository), I cleaned my configuration file using make confclean, I rebuilt the configuration using ./configure -openssl, then make and finally sudo make install. I think the issue before was that I had not cleaned my config file first. I had a version installed for embedded Linux and it is possible that I was applying the -openssl flag to that build since I had installed that later. For the record both #include <QtNetwork/QSslSocket> and #include <QSslSocket> work, at least in my version of Qt (4.8.6).

Clang on Amazon Linux from EPEL can't find C++ headers or libraries

I'm trying to compile a simple hello world test program just to get things working on our CI infrastructure build boxes and it refuses to compile on CentOS with clang (but works fine with GCC on the same platform). For completeness, here is the obviously trivial program:
#include <iostream>
int main(){
std::cout << "wow" << std::endl;
return 0;
}
Running clang++ test.cpp yields:
test.cpp:1:10: fatal error: 'iostream' file not found
I installed it with a simple sudo yum install clang and can see that when GCC gets installed on Amazon Linux it comes with its own libstdc++ headers which are in /usr/include/c++/gcc-version but it seems odd to have to specify includes to compile something like this.
Clang should be using its own (possibly libc++) instead and know where the headers and libs are on the system by default (for something like iostream at least).
Compiling and running the program works just fine with GCC here. It seems like the EPEL package for clang may not have been configured correctly, is this the case? Any help would be greatly appreciated.
As Dave mentioned, he has created new RPM packages which are now in EPEL testing. You can install them on Amazon Linux right now like this:
yum --enablerepo=epel-testing --nogpgcheck install clang
Once the packages are tested further they will be in EPEL proper (stable) and be installable using clang install.
This is caused by the "triples" not being defined to support Amazon Linux. See original patch and application for EPEL on EL6.

Error: boost/scoped_ptr.hpp: No such file or directory while using libkml

I am developing a software which uses Google Map database. I searched google and I found a library in C++ can do that - libkml. I've downloaded some examples code in this website, but when I compiled with this command: g++ main.cpp -lkml, it occured an error:
fatal error: boost/scoped_ptr.hpp: No such file or directory
What is "boost/scoped_ptr.hpp"? I try finding this file in terminal
locate boost/scoped_ptr.hpp
but there's nothing.
You need to install the boost libraries from http://www.boost.org/
Depending on your OS there will be pre-built solutions that you can install. For example on Ubuntu you can do sudo apt-get install libboost-all-dev. On Mac see this thread Boost: MacOSX binaries for Boost
On Windows this may help: http://boost.teeks99.com/

Boost "no such file or directory"

I'm trying to set up my Code::Blocks work environment on a new computer and I'm having some problems. It's been a long time since I first did this, and now when I open my major project Boost is causing me problems.
I'm fairly new to C++ still and fixing this type of problem is something I have limited experience with.
When I open my project and try to compile it, I get this error:
fatal error: boost/algorithm/string.hpp: No such file or directory|
At this part of one of my header files:
#include <boost/algorithm/string.hpp>
I placed the Boost v1.51.0 library at C:\boost since that is where I'd had it on my other computer. My project is set to search that directory for additional includes but it doesn't seem to be finding the files?
My project used an older version of Boost previously but I doubt that's an issue.
I'm not sure how difficult it is to debug this problem with this limited information so if there's anything else I can provide please let me know.
I'm using Code::Blocks, and have just set up minGW and Visual C++ 2010.
In Ubuntu use
sudo apt-get install libboost-dev
Ensure that you have installed boost-devel package
In Centos execute as root:
yum install boost-devel
then
root#centos6 /]# find / -name boost
/usr/include/boost
/usr/lib64/boost
[root#centos6 /]#