prog.c:4:1: error: unknown type name ‘using’
using namespace std;
^~~~~
prog.c:4:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘std’
using namespace std;
^~~
prog.c: In function ‘main’:
prog.c:7:6: error: expected expression before ‘:’ token
std::shared_ptr<std::string> myPtr = std::make_shared<std::string>("hello");
^
prog.c:8:2: error: duplicate label ‘std’
std::cout << "Refs: " << myPtr.use_count() << std::endl;
^~~
prog.c:7:2: note: previous definition of ‘std’ was here
std::shared_ptr<std::string> myPtr = std::make_shared<std::string>("hello");
^~~
prog.c:8:6: error: expected expression before ‘:’ token
std::cout << "Refs: " << myPtr.use_count() << std::endl;
^
prog.c:10:6: error: expected identifier or ‘(’ before ‘&’ token
auto& myPtrRef = myPtr;
^
prog.c:11:2: error: duplicate label ‘std’
std::cout << "Refs: " << myPtrRef.use_count() << std::endl;
^~~
prog.c:7:2: note: previous definition of ‘std’ was here
std::shared_ptr<std::string> myPtr = std::make_shared<std::string>("hello");
^~~
prog.c:11:6: error: expected expression before ‘:’ token
std::cout << "Refs: " << myPtrRef.use_count() << std::endl;
^
prog.c:13:7: error: type defaults to ‘int’ in declaration of ‘lambda’ [-Werror=implicit-int]
auto lambda = [myPtrRef] {
^~~~~~
prog.c:13:16: error: expected expression before ‘[’ token
auto lambda = [myPtrRef] {
^
prog.c:13:17: error: ‘myPtrRef’ undeclared (first use in this function)
auto lambda = [myPtrRef] {
^~~~~~~~
prog.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
prog.c:17:2: error: called object ‘lambda’ is not a function or function pointer
lambda();
^~~~~~
prog.c:13:7: note: declared here
auto lambda = [myPtrRef] {
^~~~~~
prog.c:7:2: error: label ‘std’ defined but not used [-Werror=unused-label]
std::shared_ptr<std::string> myPtr = std::make_shared<std::string>("hello");
^~~
cc1: all warnings being treated as errors