Reputation: 481
I am trying to use the Intel C++ compiler 19.0 to compile my code on 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:
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?
Upvotes: 0
Views: 1153
Reputation: 171263
The header <bits/unique_ptr.h>
is an internal implementation detail of GCC's standard library. It's one of the headers that makes up the implementation of <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. 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. The correct header to include is <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>
:
/** @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}
*/
Upvotes: 6