F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_23191732_8546.cpp:9:6: error: 'mutex' in namespace 'std' does not name a type
 std::mutex mtx;
      ^
0_0_23191732_8546.cpp: In function 'void print_thread_id(int)':
0_0_23191732_8546.cpp:19:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> lck (mtx);//对mtx上锁,保证在析构时解锁
                         ^
0_0_23191732_8546.cpp:19:25: error: 'mutex' is not a member of 'std'
0_0_23191732_8546.cpp:19:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> lck (mtx);//对mtx上锁,保证在析构时解锁
                                   ^
0_0_23191732_8546.cpp:19:41: error: invalid type in declaration before '(' token
         std::lock_guard<std::mutex> lck (mtx);//对mtx上锁,保证在析构时解锁
                                         ^
0_0_23191732_8546.cpp:19:42: error: 'mtx' was not declared in this scope
         std::lock_guard<std::mutex> lck (mtx);//对mtx上锁,保证在析构时解锁
                                          ^
0_0_23191732_8546.cpp: In function 'int main()':
0_0_23191732_8546.cpp:29:5: error: 'thread' is not a member of 'std'
     std::thread threads[10];
     ^
0_0_23191732_8546.cpp:32:9: error: 'threads' was not declared in this scope
         threads[i] = std::thread(print_thread_id,i+1);
         ^
0_0_23191732_8546.cpp:32:22: error: 'thread' is not a member of 'std'
         threads[i] = std::thread(print_thread_id,i+1);
                      ^
0_0_23191732_8546.cpp:34:21: error: 'threads' was not declared in this scope
     for (auto& th : threads) th.join();
                     ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-30 05:44:51, Gzip enabled