我试图让英特尔C ++ 14.0.2编译器使用C ++ 11选项。我有这个非常简单的代码(我简化了:cplusplus.com):
// shared_ptr constructor example
#include <iostream>
#include <memory>
struct C {int* data;};
int main () {
std::shared_ptr<int> p1;
std::cout << "use_count:\n";
std::cout << "p1: " << p1.use_count() << '\n';
return 0;
}
我尝试用英特尔C ++ 14.0.2编译器编译它,但我只是得到了这些错误:
$ icpc --std=c++11 test.cpp
test.cpp(8): error: namespace "std" has no member "shared_ptr"
std::shared_ptr<int> p1;
^
test.cpp(8): error: type name is not allowed
std::shared_ptr<int> p1;
^
test.cpp(8): error: identifier "p1" is undefined
std::shared_ptr<int> p1;
^
compilation aborted for test.cpp (code 2)
(我也尝试使用-std=c++11
,但遇到了同样的错误。)我使用shared_ptr
错了吗?我调用编译器错了吗?这似乎是一个简单的例子,我可以想出来解释这个问题。
答案 0 :(得分:3)
shared_ptr
未列为14.0版支持的功能之一:
http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler