我想在2010年的VisualStudio繼承人測試rdtsc
我的代碼:RDTSC上的VisualStudio 2010速成 - C++不支持默認int
#include <iostream>
#include <windows.h>
#include <intrin.h>
using namespace std;
uint64_t rdtsc()
{
return __rdtsc();
}
int main()
{
cout << rdtsc() << "\n";
cin.get();
return 0;
}
但我得到的錯誤:
------ Build started: Project: test_rdtsc, Configuration: Debug Win32 ------
main.cpp
c:\documents and settings\student\desktop\test_rdtsc\test_rdtsc\main.cpp(12): error C2146: syntax error : missing ';' before identifier 'rdtsc'
c:\documents and settings\student\desktop\test_rdtsc\test_rdtsc\main.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\student\desktop\test_rdtsc\test_rdtsc\main.cpp(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\student\desktop\test_rdtsc\test_rdtsc\main.cpp(14): warning C4244: 'return' : conversion from 'DWORD64' to 'int', possible loss of data
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
什麼都要我做?我不想將uint64_t
更改爲DWORD64
。爲什麼VisualStudio不理解uint64_t
?
這是一個C++源文件,這裏正在構建什麼。看到它提到main.cpp的初始文章。 – lpapp
而且?這就是我首先談論''的原因。我不明白你的觀點。 –
爲什麼你甚至提到C呢? – lpapp