简体   繁体   English

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

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

I have recently tried to build a library on Windows via CMake that I managed to succesfully build on Linux.我最近尝试通过 CMake 在 Windows 上构建一个库,我成功地在 Linux 上构建。 Unfortunately, there is quite a long list of errors, despite very similar compiler options between g++ / cl .不幸的是,尽管g++ / cl之间的编译器选项非常相似,但仍有很长的错误列表。 I am having a hard time to find out where the real problem is, especially since most of these errors does not make sense (they are probably side-effects of another error).我很难找出真正的问题在哪里,特别是因为这些错误中的大多数没有意义(它们可能是另一个错误的副作用)。

Is there a project-independent procedure that I can follow to find the root cause?是否有一个独立于项目的程序可以让我找到根本原因? Is there any, however complicated, order of errors in cl output? cl output 中是否有任何复杂的错误顺序?

Below, for the reference, list of errors I'm fighting against (removed full paths for readability).下面,作为参考,我正在对抗的错误列表(删除了完整路径以提高可读性)。 I have checked manually all the errors (checked types, class members etc. ).我已经手动检查了所有错误(检查类型、class 成员等)。 The only difference between compiler flags is standard ( g++ is c++98 , cl is c++14 , but that should not matter in this direction, right? )编译器标志之间的唯一区别是标准( g++c++98clc++14 ,但这在这个方向上应该没关系,对吧?)

Cheers!干杯!

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'

Couple of LOC for the first error第一个错误的几个 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);

    /**

Update with found root cause: UnicodeString is in a different namespace with updated library, and first error pointed to a proper line, just not a proper element.使用找到的根本原因进行更新: UnicodeString位于具有更新库的不同命名空间中,并且第一个错误指向正确的行,而不是正确的元素。

In answer to "In what order should I read build errors from MSVC compiler?":回答“我应该以什么顺序从 MSVC 编译器读取构建错误?”:

Always start with the first reported error.始终从第一个报告的错误开始。

Only consider later errors if you strongly believe the earlier errors cannot be their cause.如果您坚信较早的错误不是其原因,则仅考虑较晚的错误。

For example, @AdrianMole immediately honed in on your first error: "For example I would start by addressing the Unknown compiler version - please run the configure tests and report the results message."例如,@AdrianMole 立即发现您的第一个错误:“例如,我将从解决未知编译器版本开始 - 请运行配置测试并报告结果消息。”

BTW: have you seen https://codereview.stackexchange.com顺便说一句:你见过https://codereview.stackexchange.com

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

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