使用 c++ 标准库 #include <thread> #include <chrono> std::this_thread::sleep_for(std::chrono::seconds(2)); 备注: 且莫使用 linux 系统自带的 sleep(2),该函数并未真正实现睡眠