timeGetTime() is not working!!

Started by
6 comments, last by ankhd 17 years, 1 month ago
Hello!! I need some help!! the function timeGetTime() isn't recognized by VS2005. why? I'm using it to calculate the time passed between frames, can you giveme a diferent option for this purpouse please Can anyone give a link of a correct initialization of a simple game engine in VS2005 an DirectX 9.
Advertisement
Make sure you #include <mmsystem.h> and link winmm.lib
<a href="puzzlearranger.com>Puzzle Arranger (a Magical Drop/Money Puzzle Exchanger Clone)http://www.puzzlearranger.com
Add the following line before #include <windows.h> :
#define WIN32_LEAN_AND_MEAN

and link to winmm.lib
Quote:Original post by Kambiz
Add the following line before #include <windows.h> :
#define WIN32_LEAN_AND_MEAN

and link to winmm.lib


Just wondering how to link the windows.h or mmsystem.h to winmm.lib
Quote:Original post by 123abcd1983
Quote:Original post by Kambiz
Add the following line before #include <windows.h> :
#define WIN32_LEAN_AND_MEAN

and link to winmm.lib


Just wondering how to link the windows.h or mmsystem.h to winmm.lib


Your IDE's documentation will tell you how to do that. You don't link header files to libraries. You #include header files, and you add libraries to the list of additional libraries in the Linker properties page. How you get there depends on what IDE (and what version) you have.
Using MSVC++ 2005 you can easily link to winmm.lib by adding the following line to your code:
#pragma comment(lib,"winmm.lib")

Or add “winmm.lib” to Project-> Properties… -> Configuration Properties…-> Linker -> Input -> Additional Dependencies
// main.cpp#include <windows.h>#include <iostream>#pragma comment( lib, "winmm.lib" )int main() {   DWORD startTime = timeGetTime();   // some time-consuming job > 1ms   DWORD finishTime = timeGetTime();   // divide by 1000 to output in seconds   cout << "Duration: " << (finishTime - startTime)/1000.0f << " seconds" << endl;}
Hi, You could just add them by doing this.
got to projects menu then Add Existing Item, then select the path and the file you want to add.

This topic is closed to new replies.

Advertisement