In file included from /usr/include/c++/4.8.2/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from student.pb.h:9,
                 from test.cpp:5:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: 错误:#error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from student.pb.h:9,
                 from test.cpp:5:
/usr/local/include/google/protobuf/stubs/mutex.h:58:3: 错误:‘mutex’不是命名空间‘std’中的一个类型名
   std::mutex mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在成员函数‘void google::protobuf::internal::WrappedMutex::Lock()’中:
/usr/local/include/google/protobuf/stubs/mutex.h:51:17: 错误:‘mu_’在此作用域中尚未声明
   void Lock() { mu_.lock(); }
                 ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在成员函数‘void google::protobuf::internal::WrappedMutex::Unlock()’中:
/usr/local/include/google/protobuf/stubs/mutex.h:52:19: 错误:‘mu_’在此作用域中尚未声明
   void Unlock() { mu_.unlock(); }
                   ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在全局域:
/usr/local/include/google/protobuf/stubs/mutex.h:61:7: 错误:expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:61:7: 错误:‘Mutex’未声明
/usr/local/include/google/protobuf/stubs/mutex.h:61:13: 错误:expected ‘;’ before ‘=’ token
 using Mutex = WrappedMutex;
             ^
/usr/local/include/google/protobuf/stubs/mutex.h:61:13: 错误:expected unqualified-id before ‘=’ token
/usr/local/include/google/protobuf/stubs/mutex.h:66:28: 错误:expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:69:3: 错误:‘Mutex’不是一个类型名
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在析构函数‘google::protobuf::internal::MutexLock::~MutexLock()’中:
/usr/local/include/google/protobuf/stubs/mutex.h:67:24: 错误:‘class google::protobuf::internal::MutexLock’没有名为‘mu_’的成员
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在全局域:
/usr/local/include/google/protobuf/stubs/mutex.h:80:33: 错误:expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
In file included from /usr/local/include/google/protobuf/arena.h:48:0,
                 from student.pb.h:23,
                 from test.cpp:5:
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
 #pragma GCC visibility push(default)
                                     ^
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected unqualified-id before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected declaration before end of line
In file included from /usr/include/c++/4.8.2/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from student.pb.h:9,
                 from student.pb.cc:4:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: 错误:#error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from student.pb.h:9,
                 from student.pb.cc:4:
/usr/local/include/google/protobuf/stubs/mutex.h:58:3: 错误:‘mutex’不是命名空间‘std’中的一个类型名
   std::mutex mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在成员函数‘void google::protobuf::internal::WrappedMutex::Lock()’中:
/usr/local/include/google/protobuf/stubs/mutex.h:51:17: 错误:‘mu_’在此作用域中尚未声明
   void Lock() { mu_.lock(); }
                 ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在成员函数‘void google::protobuf::internal::WrappedMutex::Unlock()’中:
/usr/local/include/google/protobuf/stubs/mutex.h:52:19: 错误:‘mu_’在此作用域中尚未声明
   void Unlock() { mu_.unlock(); }
                   ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在全局域:
/usr/local/include/google/protobuf/stubs/mutex.h:61:7: 错误:expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:61:7: 错误:‘Mutex’未声明
/usr/local/include/google/protobuf/stubs/mutex.h:61:13: 错误:expected ‘;’ before ‘=’ token
 using Mutex = WrappedMutex;
             ^
/usr/local/include/google/protobuf/stubs/mutex.h:61:13: 错误:expected unqualified-id before ‘=’ token
/usr/local/include/google/protobuf/stubs/mutex.h:66:28: 错误:expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:69:3: 错误:‘Mutex’不是一个类型名
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在析构函数‘google::protobuf::internal::MutexLock::~MutexLock()’中:
/usr/local/include/google/protobuf/stubs/mutex.h:67:24: 错误:‘class google::protobuf::internal::MutexLock’没有名为‘mu_’的成员
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: 在全局域:
/usr/local/include/google/protobuf/stubs/mutex.h:80:33: 错误:expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
In file included from /usr/local/include/google/protobuf/arena.h:48:0,
                 from student.pb.h:23,
                 from student.pb.cc:4:
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
 #pragma GCC visibility push(default)
                                     ^
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected unqualified-id before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected ‘}’ before end of line
/usr/include/c++/4.8.2/typeinfo:39:37: 错误:expected declaration before end of line

 

解决办法:

g++ -std=c++11  -o protobufTest.out -lprotobuf -lpthread  test.cpp student.pb.cc

 

Logo

更多推荐