简体   繁体   中英

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. Unfortunately, there is quite a long list of errors, despite very similar compiler options between 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?

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. ). 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? )

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

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.

In answer to "In what order should I read build errors from MSVC compiler?":

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."

BTW: have you seen https://codereview.stackexchange.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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