I'm in trouble at finding the proper library for timeGetTime() function. When i try to run it, it give me this error: "undefined reference to 'timeGetTime@0'". I have win 8.1 on my pc.
1 2 3 4 5 6 7 8 9 10 11 12 13
//c++ program
#include <iostream>
#include <ctime>
#include <windows.h>
usingnamespace std;
int main()
{DWORD t=timeGetTime();
int i;
for(i=1;i<=10000;i++)
cout<<i<<"\n";
t=timeGetTime()-t;
cout<<"t="<<t;
return 0;}
I also tried to include winmm.lib as a header but this error shows up: "no such file or directory".
Now please tell me, what am i doing wrong? And if there is any solution, please try to describe it step by step (i'm a trully beginner). Thank you!
I use gnu c++ and i work in codeblocks. And i also tried to include the library in the linker from build options , but when i restart codeblocks and puts in the program above, this is what appear : " ld.exe cannot find -lwinmm.exe".
Ook i figured it out, i was given the error because of .lib suffix. Now i have another question. How to convert time given by that function into seconds? In fact, what i mean is that i don't know exactly what that time is expressed in , whether ms, or seconds, or something else?