我正在玩 ANTLR4,我有可用的词法分析器和解析器语法文件。我的目标是 cpp。但是,一些生成的 .cpp 和 .h 文件中有错误,我不确定为什么。
例如生成的Lexer.cpp文件中的这一行:
std::string name = _vocabulary.getLiteralName(i);
no suitable user-defined conversion from "std::string_view" to "std::string" existsC/C++(312)
或者在 Parser.h 文件中:
virtual const std::vector<std::string>& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
'JoltParser::getTokenNames': method with override specifier 'override' did not override any base class methods [C:\Users\...\OneDrive\Documents\Projects\jolt\build\antlr4\antlr4.vcxproj]MSVC(C3668) member function declared with 'override' does not override a base class memberC/C++(1455)
还有一些。如果您需要更多信息来帮助诊断问题,请告诉我。我正在使用 CMake 作为构建系统和 Conan 包管理器。
我试图更改我正在构建的 cpp 标准,看看是否可以修复这些错误,但我没有运气。目前我使用 c++17 得到这些错误。