繁体   English   中英

我应该按什么顺序从 MSVC 编译器读取构建错误?

[英]In what order should I read build errors from MSVC compiler?

我最近尝试通过 CMake 在 Windows 上构建一个库,我成功地在 Linux 上构建。 不幸的是,尽管g++ / cl之间的编译器选项非常相似,但仍有很长的错误列表。 我很难找出真正的问题在哪里,特别是因为这些错误中的大多数没有意义(它们可能是另一个错误的副作用)。

是否有一个独立于项目的程序可以让我找到根本原因? cl output 中是否有任何复杂的错误顺序?

下面,作为参考,我正在对抗的错误列表(删除了完整路径以提高可读性)。 我已经手动检查了所有错误(检查类型、class 成员等)。 编译器标志之间的唯一区别是标准( g++c++98clc++14 ,但这在这个方向上应该没关系,对吧?)

干杯!

affixsplit.cpp
Unknown compiler version - please run the configure tests and report the results
toki\cc\libtoki/token.h(48,39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
toki\cc\libtoki/token.h(48,27): error C2143: syntax error: missing ',' before '&'
toki\cc\libtoki/token.h(72,42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
toki\cc\libtoki/token.h(72,42): error C2143: syntax error: missing ',' before '&'
toki\cc\libtoki/token.h(79,42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
toki\cc\libtoki/token.h(79,42): error C2143: syntax error: missing ',' before '&'
toki\cc\libtoki/token.h(80,37): error C2535: 'Toki::Token *Toki::Token::clone_changed(const int) const': member function already defined or declared
toki\cc\libtoki/token.h(72): note: see declaration of 'Toki::Token::clone_changed'
toki\cc\libtoki/token.h(123,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
toki\cc\libtoki/token.h(123,21): error C2143: syntax error: missing ';' before '&'
toki\cc\libtoki/token.h(123,36): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
toki\cc\libtoki/token.h(128,35): error C2327: 'Toki::Token::UnicodeString': is not a type name, static, or enumerator
toki\cc\libtoki/token.h(128,35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
toki\cc\libtoki/token.h(128,35): error C2143: syntax error: missing ',' before '&'
toki\cc\libtoki/token.h(167,16): error C2327: 'Toki::Token::UnicodeString': is not a type name, static, or enumerator
toki\cc\libtoki/token.h(167,21): error C3646: 'orth_': unknown override specifier
toki\cc\libtoki/token.h(167,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
toki\cc\libtoki/token.h(129,3): error C2065: 'orth_': undeclared identifier
toki\cc\libtoki/token.h(129,11): error C2065: 'new_orth': undeclared identifier
toki\cc\libtoki\layers\affixsplit.cpp(55,35): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(56,26): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(58,11): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(57,17): error C2660: 'Toki::Token::clone_changed': function does not take 2 arguments
toki\cc\libtoki/token.h(72,9): note: see declaration of 'Toki::Token::clone_changed'
toki\cc\libtoki\layers\affixsplit.cpp(63,30): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(65,26): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(70,1): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(74,4): error C2065: 'UnicodeString': undeclared identifier
toki\cc\libtoki\layers\affixsplit.cpp(74,18): error C2146: syntax error: missing ';' before identifier 'body_orth'
toki\cc\libtoki\layers\affixsplit.cpp(74,18): error C2065: 'body_orth': undeclared identifier
toki\cc\libtoki\layers\affixsplit.cpp(75,11): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(76,6): error C2065: 'body_orth': undeclared identifier
toki\cc\libtoki\layers\affixsplit.cpp(77,35): error C2065: 'body_orth': undeclared identifier
toki\cc\libtoki\layers\affixsplit.cpp(82,33): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(84,11): error C2039: 'orth': is not a member of 'Toki::Token'
toki\cc\libtoki/token.h(39): note: see declaration of 'Toki::Token'
toki\cc\libtoki\layers\affixsplit.cpp(83,18): error C2660: 'Toki::Token::clone_changed': function does not take 2 arguments
toki\cc\libtoki/token.h(72,9): note: see declaration of 'Toki::Token::clone_changed'

第一个错误的几个 LOC

class Token
{
public:
    Token(const UnicodeString& orth, const std::string& type, // line 48, col 39 at second const
            PwrNlp::Whitespace::Enum wa_before);


    Token(const char* orth_utf8, const std::string& type,
            PwrNlp::Whitespace::Enum wa_before);

    /**

使用找到的根本原因进行更新: UnicodeString位于具有更新库的不同命名空间中,并且第一个错误指向正确的行,而不是正确的元素。

回答“我应该以什么顺序从 MSVC 编译器读取构建错误?”:

始终从第一个报告的错误开始。

如果您坚信较早的错误不是其原因,则仅考虑较晚的错误。

例如,@AdrianMole 立即发现您的第一个错误:“例如,我将从解决未知编译器版本开始 - 请运行配置测试并报告结果消息。”

顺便说一句:你见过https://codereview.stackexchange.com

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM