簡體   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