我的專案在 Windows (vc 17) 上構建,我是 Linux 構建的新手,所以我不確定發生了什么。
我為我的專案創建了 CMakeLists 檔案(具有 C 17 要求),生成了 makefile,然后我曾經make嘗試在 Linux 上構建它。錯誤是:
/home/julien/source/zipfs/zipfs/include/zipfs/zipfs_assert.h:30:70: error: no matching function for call to ‘std::exception::exception(<brace-enclosed initializer list>)’
30 | zipfs_usage_error_t(const char* message) : std::exception{ message } {}
| ^
In file included from /usr/include/c /9/exception:38,
from /usr/include/c /9/new:40,
from /usr/include/c /9/ext/new_allocator.h:33,
from /usr/include/x86_64-linux-gnu/c /9/bits/c allocator.h:33,
from /usr/include/c /9/bits/allocator.h:46,
from /usr/include/c /9/string:41,
from /home/julien/source/zipfs/zipfs/include/zipfs/zipfs_path_t.h:3,
from /home/julien/source/zipfs/zipfs/include/zipfs/zipfs_error_t.h:3,
from /home/julien/source/zipfs/zipfs/source/zipfs_error_t.cpp:1:
涉案代碼為:
zipfs_usage_error_t(const char* message) : std::exception{ message } {}
我看不出這有什么問題;是 c 版本不匹配嗎?
uj5u.com熱心網友回復:
std::exception 不提供接受const char*引數的建構式。
如果您正在使用的 Windows 標準庫中存在一個,則它是該語言的不可移植擴展。
有許多派生類可以用作您的基類,它們確實支持此建構式。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/457302.html
標籤:C ubuntu linux-mint
