Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble building paho.mqtt.cpp #130

Closed
helo-ch opened this issue Oct 24, 2017 · 4 comments
Closed

Trouble building paho.mqtt.cpp #130

helo-ch opened this issue Oct 24, 2017 · 4 comments

Comments

@helo-ch
Copy link

helo-ch commented Oct 24, 2017

I'm trying to install paho.mqtt.cpp on a VM running CentOs 6. I have successfully installed and used paho.mqtt.c, but when I try to build paho.mqtt.cpp I get a lot of errors after the make command :

[  7%] Building CXX object src/CMakeFiles/OBJS.dir/async_client.cpp.o
In file included from /home/heloise/paho.mqtt.cpp/src/mqtt/async_client.h:28,
                 from /home/heloise/paho.mqtt.cpp/src/async_client.cpp:19:
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:37: erreur: expected nested-name-specifier before ‘byte’
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:37: erreur: ‘byte’ has not been declared
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:37: erreur: expected ‘;’ before ‘=’ token
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:37: erreur: expected unqualified-id before ‘=’ token
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:40: erreur: expected nested-name-specifier before ‘string’
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:40: erreur: ‘string’ has not been declared
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:40: erreur: expected ‘;’ before ‘=’ token
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:40: erreur: expected unqualified-id before ‘=’ token
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:42: erreur: expected nested-name-specifier before ‘binary’
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:42: erreur: ‘binary’ has not been declared
/home/heloise/paho.mqtt.cpp/src/mqtt/types.h:42: erreur: expected ‘;’ before ‘=’ token

.....and so on for quite a while.

The errors end by

make[2]: *** [src/CMakeFiles/OBJS.dir/async_client.cpp.o] Erreur 1
make[1]: *** [src/CMakeFiles/OBJS.dir/all] Erreur 2
make: *** [all] Erreur 2

I have no idea what went wrong since I was only following the build instructions? The C++ compiler on my system is g++.

Thanks in advance for your help.

Héloïse

@fpagliughi
Copy link
Contributor

What version of g++? I believe the default compiler on CentOS 6 was pretty old. The Paho library requires a conforming C++11 compiler, so for g++, that's at least v4.8, I believe. What is shown with the command:

g++ --version

@helo-ch
Copy link
Author

helo-ch commented Oct 24, 2017

It appears that I was indeed using g++ 4.4.7.

However I just updated it to g++ 4.8.2 and I still get the same errors after running make.

@fpagliughi
Copy link
Contributor

Are you sure that 4.8.2 is now the default compiler?
What is the version of CMake that you're using? You need 3.1 or newer.

If all of that looks good, maybe you need to regenerate the CMake cache? Delete your build directory and re-run CMake.

If that fails, post the full output from the initial CMake command, at least up until the first few errors.

And then, try a build using the default GNU Makefile in the top directory. Just:

cd paho.mqtt.cpp
make

@helo-ch
Copy link
Author

helo-ch commented Oct 25, 2017

I regenerated the CMake cache and it worked, thank you!

@helo-ch helo-ch closed this as completed Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants