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.
All executor interfaces have been upgraded a (long) while ago .
Strands used to be nested typedefs (and there is still one for "legacy" compatibility in io_service
if that is enabled).
However, the new type succeeding is is boost::asio::strand<Executor>
(so eg boost::asio::io_context::executor_type
). You can easily make a strand for any executor, eg:
auto s = make_strand(io_object.get_executor());
What you are seeing is apparent mix-up of these names. I suspect it may have to do with
strand
strand
(though I don't see immediately how that would lead to the exact message mposted)using namespace
that pulls in the new strand
templateWith this information, you should be able to sort it out.
Of course, had you posted the code, we could have shown it for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.