use*_*032 1 compiler-errors shared-ptr c++11
我正在尝试在Raspberry Pi上编译代码w/shared_ptrs:
#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
shared_ptr<string> message1(new string("Hello Raspberry Pi C++11"));
cout << *message1 <<endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
test.cpp: In function 'int main(int, char**)': test.cpp:4:4: error: 'shared_ptr' was not declared in this scope
shared_ptr<string> message1(new string("Hello Raspberry Pi C++11"));
^ test.cpp:4:21: error: expected primary-expression before '>' token
shared_ptr<string> message1(new string("Hello Raspberry Pi C++11"));
^ test.cpp:4:70: error: 'message1' was not declared in this scope
shared_ptr<string> message1(new string("Hello Raspberry Pi C++11"));
Run Code Online (Sandbox Code Playgroud)
我用这个命令编译:g++ -std=c++11 -o test test.cpp
G ++版本是g ++(Raspbian 4.8.2-21~rpi3rpi1)4.8.2
请帮忙.