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);
交流QQ号:1175372067
电话:18551717618(同微信)
元几科技.软件3部
迈开步伐去探索
南京元几科技有限公司
元几社区: https://www.cnblogs.com/colin-vio
元几官网: http://www.yuanji.tech
-----------------------------------------------------------------------------