Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
#include<stdio.h>
#include<conio.h>
#include<windows.h>
int main(){
  LARGE_INTEGER frequency;
  LARGE_INTEGER e,s,diff;
  QueryPerformanceCounter(&s);
  for(int i=0;i<100;i++)
  {}
  QueryPerformanceCounter(&e);
  diff=(e-s)/frequency*1000;
  unsigned int milliseconds = (unsigned int)(diff & 0xffffffff);
  printf("%u",milliseconds);
  getch();
  return 0;
}


i am trying to execute this program im getting an error as
no match for 'operator'- in 'e-s'

can anyone help me out with this. Thank in prior...
Posted

1 solution

LARGE_INTEGER is a union and doesn't define the "-" operator. Use the QuadPart member (as in e.QuadPart-s.QuadPart) or use __int64 instead.
 
Share this answer
 
Comments
project.gearup 11-Sep-10 3:13am    
Thanks Richard it works...
Richard Hauer (5 Limes) 11-Sep-10 3:14am    
You're welcome - voting on my answer is good for my profile!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900