analogdevicesinc / gr-iio

IIO blocks for GNU Radio
GNU General Public License v3.0
94 stars 62 forks source link

make: boost error #91

Closed black-pigeon closed 2 years ago

black-pigeon commented 3 years ago

image Hello, When I started to work with this project, the problem shows in the picture,what could result this? Thanks a lot!!!

black-pigeon commented 3 years ago

When I get back to the last version, there shows no error. Maybe the latest version have some problem? Or maybe my computer environment need some changes?

commodo commented 3 years ago

What version of the boost libraries are you using? And what distro?

kerrynwood commented 3 years ago

I think this is related to #87. I had a similar problem on Mac (clang V12.0.0), compiling against boost 1.60.

My fix was to add the boost:placeholders namespace.

diff --git a/lib/attr_sink_impl.cc b/lib/attr_sink_impl.cc
index 0bc869c..ae088bb 100644
--- a/lib/attr_sink_impl.cc
+++ b/lib/attr_sink_impl.cc
@@ -29,6 +29,8 @@
 #include <iostream>
 #include <boost/lexical_cast.hpp>

+using namespace boost::placeholders;
+
 namespace gr {
   namespace iio {
u-eng commented 2 years ago

Adding 'namespace boost::placeholders' in attr_sink_impl.cc doesn't seem to work for me. I'm on Ubuntu 16.04, installed gnuradio 3.7.9.1 using apt install gnuradio, and cloned the master branch of gr-iio (which is same as maint-3.7 I guess). Any ideas on how you resolved this issue?

Also boost version is 1.58.

This is the error I'm getting if I add 'using namespace boost::placeholders;':

/home/sspace/workarea/gr-iio/lib/attr_sink_impl.cc:32:24: error: ‘placeholders’ is not a namespace-name using namespace boost::placeholders; ^ /home/sspace/workarea/gr-iio/lib/attr_sink_impl.cc:32:36: error: expected namespace-name before ‘;’ token using namespace boost::placeholders; ^ /home/sspace/workarea/gr-iio/lib/attr_sink_impl.cc: In constructor ‘gr::iio::attr_sink_impl::attr_sink_impl(const string&, const string&, const string&, int, bool, bool)’: /home/sspace/workarea/gr-iio/lib/attr_sink_impl.cc:94:99: error: ‘boost::placeholders’ has not been declared "attr"), boost::bind(&attr_sink_impl::write_attribute, this, boost::placeholder ^ lib/CMakeFiles/gnuradio-iio.dir/build.make:198: recipe for target 'lib/CMakeFiles/gnuradio-iio.dir/attr_sink_impl.cc.o' failed make[2]: [lib/CMakeFiles/gnuradio-iio.dir/attr_sink_impl.cc.o] Error 1 CMakeFiles/Makefile2:218: recipe for target 'lib/CMakeFiles/gnuradio-iio.dir/all' failed make[1]: [lib/CMakeFiles/gnuradio-iio.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2