c++编译报错 error: parse error in template argument list

[ 57%] Building CXX object dnet/CMakeFiles/dnet.dir/dconfig/dconfig_manager.cpp.o
In file included from /home/vi/git/dos/dnet/dconfig/dconfig_manager.cpp:1:
/home/vi/git/dos/dnet/./dconfig/dconfig_manager.h: In member function ‘T dnet::dconfig_manager::get_value(dnet::dconfig_type, std::string) const’:
/home/vi/git/dos/dnet/./dconfig/dconfig_manager.h:28:34: error: parse error in template argument list
28 | return sp_config->get_value<typename T>(key);
| ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [dnet/CMakeFiles/dnet.dir/build.make:104: dnet/CMakeFiles/dnet.dir/dconfig/dconfig_manager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:449: dnet/CMakeFiles/dnet.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

出错代码如下图所示:

 解决方案:

28行修改为:  return sp_config->get_value<T>(key);

posted @ 2023-04-21 15:25  元几科技  阅读(296)  评论(0编辑  收藏  举报