chanho-code / ORB-SLAM3forWindows

ORB-SLAM3 for Windows Platform
GNU General Public License v3.0
72 stars 32 forks source link

Having an error in defining usleep function and std::chrono::monotonic_clock #2

Open Zeinab-E opened 3 years ago

Zeinab-E commented 3 years ago

Hi, Can you please let me know what usleep function you added in the example? Since I have got an error by defining the following usleep finction and also got an error in line 181 of mono_inertial_euroc.cc std::chrono::monotonic_clock::time_point time2 = std::chrono::monotonic_clock::now();: which it said "Error (active) E0304 no instance of function template "std::chrono::duration_cast" matches the argument list mono_inertial_euroc"

include

void usleep(__int64 usec) { HANDLE timer; LARGE_INTEGER ft;

ft.QuadPart = -(10*usec); // Convert to 100 nanosecond interval, negative value indicates relative time

timer = CreateWaitableTimer(NULL, TRUE, NULL); 
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); 
WaitForSingleObject(timer, INFINITE); 
CloseHandle(timer); 

}

I would greatly appreciate it if you could help me.

chanho-code commented 3 years ago

Thank you for your interest in my project.

I also used the same "usleep" function (you mentioned). Try using steady_clock rather than monotonic_clock. (with "COMPILEDWITHC11" in preprocessor definition)

AbhiKhoyani commented 1 year ago

the problem is while building application windows.h is interfering std::max() and std::min() functions, due to which it is raising error. how to tackle it besides mentioned in this thread: https://stackoverflow.com/questions/5004858/why-is-stdmin-failing-when-windows-h-is-included ; because as it's mentioned in here changing at all places is not an optimal solution.