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

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

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

是否有独立于项目的程序可供我遵循以找到根本原因? cl 输出中是否存在错误顺序,无论多么复杂?

下面是我要解决的错误列表,供参考(为了便于阅读,删除了完整路径)。我手动检查了所有错误(检查类型、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