- 论坛徽章:
- 0
|
#include <stdio.h>
#include <windows.h>
void main()
{
LARGE_INTEGER t0, t1, f;
QueryPerformanceFrequency(&f);
QueryPerformanceCounter(&t0);
Sleep(1000);
QueryPerformanceCounter(&t1);
printf("%f\n", (double)(t1.QuadPart - t0.QuadPart) / f.QuadPart);
}
上面这段代码执行时没有错误~
当我把它加入到我自己的程序里时出错:
error C2059: syntax error : 'constant'
winnt.h(5441) : error C2238: unexpected token(s) preceding ';'
syntax error : found 'int (' at global scope (was a declaration intended?)
type 'int' unexpected
error C2059: syntax error : ')'
error C2065: 't1' : undeclared identifier
error C2228: left of '.QuadPart' must have class/struct/union type
error C2065: 't0' : undeclared identifier
error C2228: left of '.QuadPart' must have class/struct/union type
error C2065: 'f' : undeclared identifier
error C2228: left of '.QuadPart' must have class/struct/union type
syntax error : found 'int (' at global scope (was a declaration intended?)
error C2062: type 'int' unexpected
error C2059: syntax error : ')'
error C2143: syntax error : missing ';' before '{'
error C2447: missing function header (old-style formal list?)
执行 cl.exe 时出错.
1 error(s), 0 warning(s) |
|