[英]Intel C++ compiler on Windows catastrophic error: cannot open source file “bits/unique_ptr.h”
I am trying to use the Intel C++ compiler 19.0 to compile my code on Windows. 我正在尝试使用Intel C ++编译器19.0在Windows上编译我的代码。 I am using the following call:
我正在使用以下电话:
icl /Qstd=c++11 c:\\Users\\Bernardo\\Downloads\\HW1_6200\\ProjectAmina\\WaterPaths\\src\\SystemComponents\\Utility\\Utility.cpp
Even though this code compiles on Linux systems, when I try to compile it on Windows I get the following error: 即使此代码可以在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)
For some reason, my standard library doesn't seem to have smart pointers. 由于某种原因,我的标准库似乎没有智能指针。 What am I missing?
我想念什么?
The header <bits/unique_ptr.h>
is an internal implementation detail of GCC's standard library. 头文件
<bits/unique_ptr.h>
是GCC标准库的内部实现细节。 It's one of the headers that makes up the implementation of <memory>
. 它是构成
<memory>
的实现的头文件之一。
So it looks like your code is trying to include a header from the GCC standard library, which works fine if you compile with GCC's standard library, but not when using a different standard library. 因此,看起来您的代码正在尝试包含GCC标准库中的标头,如果您使用GCC标准库进行编译,则可以正常工作,但使用其他标准库时则不能。 And that should be obvious.
这应该是显而易见的。 You can't include a header that doesn't exist in a different implementation.
您不能包含其他实现中不存在的标头。
User code should never try to include <bits/unique_ptr.h>
directly, because it doesn't even exist in other implementations of the C++ standard library. 用户代码永远不要试图直接包含
<bits/unique_ptr.h>
,因为它甚至不存在于C ++标准库的其他实现中。 The correct header to include is <memory>
. 要包含的正确标题是
<memory>
。 The code needs to be fixed to stop trying to include internal implementation details of a specific implementation. 需要修复代码,以停止尝试包含特定实现的内部实现细节。
There's even a comment saying this in <bits/unique_ptr.h>
: 在
<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.