mercredi 10 novembre 2021

invalid use of template-name ‘boost::asio::strand’ without an argument list

I have an older program that I want to compile on Centos 8 with GCC 8.3.1. The make command looks like this:

CXXFLAGS = -O2 -std=c++11

all: my_prog

my_prog: my_prog.o
    g++ my_prog.o -o my_prog -lboost_filesystem -lboost_system -lsecond_level_include -lthird_level_include -lboost_regex -lboost_program_options `mysql_config --libs`

Here is the output for make:

In file included from /usr/local/include/redisclient/redissyncclient.h:16,
                 from /usr/local/include/third_level_include.hpp:11,
                 from /usr/local/include/second_level_include.hpp:40,
                 from my_prog.cpp:9:
/usr/local/include/redisclient/impl/redisclientimpl.h:72:5: error: invalid use of template-name ‘boost::asio::strand’ without an argument list
     boost::asio::strand strand;
     ^~~~~
/usr/local/include/redisclient/impl/redisclientimpl.h:72:5: note: class template argument deduction is only available with -std=c++17 or -std=gnu++17
In file included from /usr/local/include/redisclient/impl/redisclientimpl.h:13,
                 from /usr/local/include/redisclient/redissyncclient.h:16,
                 from /usr/local/include/third_level_include.hpp:11,
                 from /usr/local/include/second_level_include.hpp:40,
from my_prog.cpp:9:
/usr/include/boost/asio/strand.hpp:29:7: note: ‘template<class Executor> class boost::asio::strand’ declared here
 class strand
       ^~~~~~

[snip lots of output]

So I did what it suggested and replaced -std=c++11 with -std=gnu++17 and now I get this:

g++ -O2 -std=gnu++17   -c -o my_prog.o my_prog.cpp
In file included from /usr/local/include/redisclient/redissyncclient.h:16,
                 from /usr/local/include/third_level_include.hpp:11,
                 from /usr/local/include/second_level_include.hpp:40,
                 from my_prog.cpp:9:
/usr/local/include/redisclient/impl/redisclientimpl.h:72:5: error: invalid use of template-name ‘boost::asio::strand’ without an argument list
     boost::asio::strand strand;
     ^~~~~
make: *** [<builtin>: my_prog.o] Error 1

Considering that I'm not going to be changing the third party library code from Redis, is there a compiler flag or something I can use to make this error go away? The code compiled once upon a time with GCC 4.4.7 on Centos 6.

Aucun commentaire:

Enregistrer un commentaire