簡體   English   中英

Windows上的Intel C ++編譯器發生災難性錯誤:無法打開源文件“ bits / unique_ptr.h”

[英]Intel C++ compiler on Windows catastrophic error: cannot open source file “bits/unique_ptr.h”

我正在嘗試使用Intel C ++編譯器19.0在Windows上編譯我的代碼。 我正在使用以下電話:

icl /Qstd=c++11 c:\\Users\\Bernardo\\Downloads\\HW1_6200\\ProjectAmina\\WaterPaths\\src\\SystemComponents\\Utility\\Utility.cpp

即使此代碼可以在Linux系統上編譯,但是當我嘗試在Windows上進行編譯時,也會出現以下錯誤:

c:\Users\Bernardo\Downloads\HW1_6200\ProjectAmina\WaterPaths>icl /Qstd=c++11 c:\Users\Bernardo\Downloads\HW1_6200\ProjectAmina\WaterPaths\src\SystemComponents\Utility\Utility.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.3.203 Build 20190206
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

Utility.cpp
c:\Users\Bernardo\Downloads\HW1_6200\ProjectAmina\WaterPaths\src\SystemComponents\Utility\Utility.h(10): catastrophic error: cannot open source file "bits/unique_ptr.h"
  #include <bits/unique_ptr.h>
                              ^

compilation aborted for c:\Users\Bernardo\Downloads\HW1_6200\ProjectAmina\WaterPaths\src\SystemComponents\Utility\Utility.cpp (code 4)

由於某種原因,我的標准庫似乎沒有智能指針。 我想念什么?

頭文件<bits/unique_ptr.h>是GCC標准庫的內部實現細節。 它是構成<memory>的實現的頭文件之一。

因此,看起來您的代碼正在嘗試包含GCC標准庫中的標頭,如果您使用GCC標准庫進行編譯,則可以正常工作,但使用其他標准庫時則不能。 這應該是顯而易見的。 您不能包含其他實現中不存在的標頭。

用戶代碼永遠不要試圖直接包含<bits/unique_ptr.h> ,因為它甚至不存在於C ++標准庫的其他實現中。 要包含的正確標題是<memory> 需要修復代碼,以停止嘗試包含特定實現的內部實現細節。

<bits/unique_ptr.h>甚至有一條評論說:

/** @file bits/unique_ptr.h
 *  This is an internal header file, included by other library headers.
 *  Do not attempt to use it directly. @headername{memory}
 */

std::unique_ptr的正確頭文件是

#include <memory>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM