i know this is a basic error.. and im sure ive seen/solved it before but i need sleep and its driving me mad.
im getting the following error when trying to compile very simple code.
now im pretty sure theres nothing wrong with my winnt header file, can anyone spot my error cos i surely cant.
(PS: ive used these files in another project and they worked fine)
AccurateTimer.h
AccurateTimer.cpp
thanx in advance for saving my sanity
If somethings hard to do, its not worth doing - Homer Simpson
im getting the following error when trying to compile very simple code.
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\winnt.h(152) : error C2146: syntax error : missing ';' before identifier 'WCHAR'
now im pretty sure theres nothing wrong with my winnt header file, can anyone spot my error cos i surely cant.
(PS: ive used these files in another project and they worked fine)
AccurateTimer.h
Code:
// AccurateTimer.h: interface for the AccurateTimer class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ACCURATETIMER_H__83F795EC_A278_499B_BD11_73B17E05FF69__INCLUDED_)
#define AFX_ACCURATETIMER_H__83F795EC_A278_499B_BD11_73B17E05FF69__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <winnt.h>
#include <winbase.h>
#include "ltbasetypes.h" //contains definition of LTFLOAT
class AccurateTimer
{
public:
void CheckReset(LTFLOAT LithTime);
LTFLOAT GetTime();
AccurateTimer();
virtual ~AccurateTimer();
private:
void ResetTimeStart();
LARGE_INTEGER m_liStart;
LARGE_INTEGER m_liFrequency;
LTFLOAT m_ltfLastLithTime;
};
extern AccurateTimer g_pAccurateTimer;
#endif // !defined(AFX_ACCURATETIMER_H__83F795EC_A278_499B_BD11_73B17E05FF69__INCLUDED_)
AccurateTimer.cpp
Code:
// AccurateTimer.cpp: implementation of the AccurateTimer class.
//
//////////////////////////////////////////////////////////////////////
#include "AccurateTimer.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
AccurateTimer::AccurateTimer()
{
//query the frequency for our calculations
QueryPerformanceFrequency(&liFrequency);
// Start time measurement
::QueryPerformanceCounter(&liStart);
}
AccurateTimer::~AccurateTimer()
{
//destructor code
}
LTFLOAT AccurateTimer::GetTime()
{
LARGE_INTEGER liCurrent;
// Query for time measurement
QueryPerformanceCounter(&liCurrent);
LONGLONG llTimeDiff = liCurrent.QuadPart - liStart.QuadPart;
// To get duration in milliseconds
return (LTFLOAT)llTimeDiff / (LTFLOAT)liFrequency.QuadPart;
}
void AccurateTimer::CheckReset(LTFLOAT LithTime)
{
if(LithTime<LastLithTime)
{
ResetTimeStart();
LastLithTime=0.0f;
}
else
LastLithTime=LithTime;
}
void AccurateTimer::ResetTimeStart()
{
//reset start time
::QueryPerformanceCounter(&liStart);
}
AccurateTimer g_pAccurateTimer;
thanx in advance for saving my sanity
If somethings hard to do, its not worth doing - Homer Simpson