Is it possible with macros make cross platform Sleep code? For example
#ifdef LINUX
#include
#endif
#ifdef WINDOWS
since c++ 11 you could just do this.
#include
#include
int main(){
std::this_thread::sleep_for(std::chrono::milliseconds(x));//sleeps for x milliseconds
std::this_thread::sleep_for(std::chrono::seconds(x));//sleeps for x seconds
std::this_thread::sleep_for(std::chrono::minutes(x));//sleeps for x minutes
std::this_thread::sleep_for(std::chrono::hours(x));//sleeps for x hours.
return 0;
}
I don't know why would you want to use messy macros when you can do this, this method is great, cross platform and is included in the c++ standard.