vcpkg安装log4cpp出现旧版本问题导致C++17编译报错
问题:vcpkg安装的log4cpp版本过旧引发C++17编译错误
我通过Clion使用vcpkg安装的log4cpp是2017年6月3日之前的旧版本,导致编译报错,不确定操作哪里出了问题。
vcpkg中的log4cpp包对应仓库里,include/log4cpp/Priority.hh文件末尾代码如下:
static Value getPriorityValue(const std::string& priorityName); }; } #endif // _LOG4CPP_PRIORITY_HH
但本地安装后的文件C:\Users\ME\.clion-vcpkg\vcpkg\installed\x64-windows\include\log4cpp\Priority.hh末尾仍保留了动态异常声明:
static Value getPriorityValue(const std::string& priorityName) throw(std::invalid_argument); }; } #endif // _LOG4CPP_PRIORITY_HH
这触发了C++17的编译错误:
C:/Users/ME/.clion-vcpkg/vcpkg/installed/x64-windows/include/log4cpp/Priority.hh:107:9: error: ISO C++17 does not allow dynamic exception specifications 107 | throw(std::invalid_argument); | ^~~~~
另外,vcpkg显示安装的是2.9.1#8版本,而log4cpp官方最新版本是2023年3月发布的1.1.4rc3。我尝试手动安装,但遇到了pthreads依赖问题,希望能找到便捷安装正确版本log4cpp的方法。
需要注意的是,vcpkg对应的仓库在2017年6月3日已经有移除该throw语句的commit,但vcpkg的包并未同步这个修复。
内容的提问来源于stack exchange,提问作者Ronnie Marksch
相关产品推荐
相关产品推荐

