Sign in to follow this  
papitorico

timeGetTime() is not working!!

Recommended Posts

papitorico    114
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.

Share this post


Link to post
Share on other sites
123abcd1983    122
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

Share this post


Link to post
Share on other sites
Dave Hunt    4872
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.

Share this post


Link to post
Share on other sites
Kambiz    758
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

Share this post


Link to post
Share on other sites
Ashkan    451

// 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;

}


Share this post


Link to post
Share on other sites
ankhd    2304
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this