【qt】xxx.h:42: error: C2146: 语法错误: 缺少“;”(在标识符“xxx”的前面)

博客围绕问题展开,包含问题描述、定位以及解决方案等关键信息,聚焦信息技术领域问题的处理流程。

【问题描述】

【问题定位】

【解决方案】

/root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.cpp: At global scope: /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.cpp:161:18: error: ‘Optional’ in namespace ‘clang’ does not name a template type 161 | const clang::Optional<clang::FileEntryRef> file, | ^~~~~~~~ /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.cpp:161:26: error: expected ‘,’ or ‘...’ before ‘<’ token 161 | const clang::Optional<clang::FileEntryRef> file, | ^ In file included from /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/cpp_clang.cpp:5: /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/clangtoolastreader.h: In constructor ‘LupdateVisitor::LupdateVisitor(clang::ASTContext*, Stores*): /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/clangtoolastreader.h:38:68: warning: ‘llvm::StringRef clang::FileEntry::getName() const’ is deprecated: Use FileEntryRef::getName() instead. [-Wdeprecated-declarations] 37 | m_inputFile = m_context->getSourceManager().getFileEntryForID( | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 | m_context->getSourceManager().getMainFileID())->getName(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ In file included from /usr/lib/llvm-18/include/clang/Basic/SourceLocation.h:17, from /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/cpp_clang.h:22, from /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/cpp_clang.cpp:4: /usr/lib/llvm-18/include/clang/Basic/FileEntry.h:332:13: note: declared here 332 | StringRef getName() const { return LastRef->getName(); } | ^~~~~~~ /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.cpp: In member function ‘void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation, const clang::Token&, llvm::StringRef, bool, clang::CharSourceRange, int): /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.cpp:168:10: error: ‘file’ was not declared in this scope 168 | if (!file) | ^~~~ /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.cpp:171:41: error: ‘file’ was not declared in this scope 171 | clang::StringRef fileNameRealPath = file-> | ^~~~ In file included from /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/cpp_clang.cpp:7: /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.h: At global scope: /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.h:56:42: error: ‘Optional’ in namespace ‘clang’ does not name a template type 56 | const clang::Optional<clang::FileEntryRef> file, | ^~~~~~~~ /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.h:56:50: error: expected ‘,’ or ‘...’ before ‘<’ token 56 | const clang::Optional<clang::FileEntryRef> file, | ^ /root/qt-everywhere-src-6.4.2/qttools/src/linguist/lupdate/lupdatepreprocessoraction.h:52:10: error: ‘void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation, const clang::Token&, llvm::StringRef, bool, clang::CharSourceRange, int)’ marked ‘override’, but does not override 52 | void InclusionDirective(clang::SourceLocation /*hashLoc*/, const clang::Token &/*includeTok*/, | ^~~~~~~~~~~~~~~~~~
09-29
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

草丛中的蝈蝈

您的鼓励是我最大的动力....

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值