Error C3861: 'usleep': identifier not found. under win32 #212

Closed
rcurtin opened this Issue Dec 29, 2014 · 2 comments

Projects

None yet

1 participant

@rcurtin
Member
rcurtin commented Dec 29, 2014

Reported by zy26 on 16 Dec 42233460 11:40 UTC
For cli_test.cpp, we need usleep on win32.

See http://filipivianna.blogspot.com/2010/07/usleep-on-windows-win32.html

error C3861: 'usleep': identifier not found mlpack\src\mlpack\tests\cli_test.cpp    212 1   mlpack_test

An ugly fix is add those code to line 12 of cli_test.cpp

#else
#include<windows.h>
void usleep(int waitTime){
  __int64 time1 = 0, time2 = 0, sysFreq = 0;
  QueryPerformanceCounter((LARGE_INTEGER *)&time1);
  QueryPerformanceFrequency((LARGE_INTEGER *)&sysFreq);
  do{
    QueryPerformanceCounter((LARGE_INTEGER *)&time2);
  }while( (time2-time1) <waitTime);
}
@rcurtin rcurtin self-assigned this Dec 29, 2014
@rcurtin rcurtin added this to the mlpack 1.0.2 milestone Dec 29, 2014
@rcurtin rcurtin closed this Dec 29, 2014
@rcurtin
Member
rcurtin commented Dec 30, 2014

Commented by rcurtin on 4 Aug 42233501 03:48 UTC
I think I have this fixed in r11995 but I haven't tested it yet (still booting the Windows box). You said you're using VS2010, so I'm surprised I didn't come across this problem already in my VS2010 testing. If I find it fails on Windows, I'll have a fix for it shortly.

@rcurtin
Member
rcurtin commented Dec 30, 2014

Commented by rcurtin on 22 Mar 42233535 12:47 UTC
The fix in r11995 works, but the test required a very minor (trivial) fix which I committed in r11996 to pass (> != >=).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment