C++ uint64未命名类型
每次我尝试使用uint64执行时,编译器都会显示此消息“uint64未命名类型”,uint或unit32也是如此,我已经导入了stdint.h,但没有用。另一个问题是,当我使用int执行时,变量z会得到不同的值,小于-160000,然后小于-140000,依此类推。如何解决这个问题?这是密码C++ uint64未命名类型,c++,C++,每次我尝试使用uint64执行时,编译器都会显示此消息“uint64未命名类型”,uint或unit32也是如此,我已经导入了stdint.h,但没有用。另一个问题是,当我使用int执行时,变量z会得到不同的值,小于-160000,然后小于-140000,依此类推。如何解决这个问题?这是密码 #include <Windows.h> #include <ctime> #include <stdint.h> #include <iostream> u
#include <Windows.h>
#include <ctime>
#include <stdint.h>
#include <iostream>
using std::cout;
using std::endl;
#include <fstream>
using std::ifstream;
#include <cstring>
/* Returns the amount of milliseconds elapsed since the UNIX epoch. Works on both
* windows and linux. */
uint64 GetTimeMs64()
{
FILETIME ft;
LARGE_INTEGER li;
/* Get the amount of 100 nano seconds intervals elapsed since January 1, 1601 (UTC) and copy it
* to a LARGE_INTEGER structure. */
GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
uint64 ret;
ret = li.QuadPart;
ret -= 116444736000000000LL; /* Convert from file time to UNIX epoch time. */
ret /= 10000; /* From 100 nano seconds (10^-7) to 1 millisecond (10^-3) intervals */
return ret;
}
const int MAX_CHARS_PER_LINE = 512;
const int MAX_TOKENS_PER_LINE = 20;
const char* const DELIMITER = "|";
int main()
{
// create a file-reading object
ifstream fin;
fin.open("promotion.txt"); // open a file
if (!fin.good())
return 1; // exit if file not found
// read each line of the file
while (!fin.eof())
{
// read an entire line into memory
char buf[MAX_CHARS_PER_LINE];
fin.getline(buf, MAX_CHARS_PER_LINE);
// parse the line into blank-delimited tokens
int n = 0; // a for-loop index
// array to store memory addresses of the tokens in buf
const char* token[MAX_TOKENS_PER_LINE] = {}; // initialize to 0
// parse the line
token[0] = strtok(buf, DELIMITER); // first token
if (token[0]) // zero if line is blank
{
for (n = 1; n < MAX_TOKENS_PER_LINE; n++)
{
token[n] = strtok(0, DELIMITER); // subsequent tokens
if (!token[n]) break; // no more tokens
}
}
// process (print) the tokens
for (int i = 0; i < n; i++) // n = #of tokens
cout << "Token[" << i << "] = " << token[i] << endl;
cout << endl;
}
uint64 z = GetTimeMs64();
cout << z << endl;
system("pause");
}
#包括
#包括
#包括
#包括
使用std::cout;
使用std::endl;
#包括
使用std::ifstream;
#包括
/*返回自UNIX纪元以来经过的毫秒数。两者都适用
*windows和linux*/
uint64 GetTimeMs64()
{
文件时间ft;
大整数李;
/*获取自1601年1月1日(UTC)以来经过的100纳秒间隔量并复制它
*到一个大的整数结构*/
GetSystemTimeAsFileTime(&ft);
li.LowPart=ft.dwLowDateTime;
li.HighPart=ft.dwHighDateTime;
uint64 ret;
ret=li.QuadPart;
ret-=1164444736000000000ll;/*从文件时间转换为UNIX纪元时间*/
ret/=10000;/*从100纳秒(10^-7)到1毫秒(10^-3)的间隔*/
返回ret;
}
每行最大字符数=512;
const int MAX_TOKENS_PER_LINE=20;
常量字符*常量分隔符=“|”;
int main()
{
//创建文件读取对象
流鳍;
fin.open(“promotion.txt”);//打开一个文件
如果(!fin.good())
返回1;//如果找不到文件,则退出
//读取文件的每一行
而(!fin.eof())
{
//把一整行读入内存
char buf[每行最大字符数];
fin.getline(buf,每行最大字符数);
//将行解析为空白分隔标记
int n=0;//一个for循环索引
//用于在buf中存储令牌的内存地址的数组
const char*token[MAX_TOKENS_PER_LINE]={};//初始化为0
//解析行
令牌[0]=strtok(buf,分隔符);//第一个令牌
if(标记[0])//如果行为空,则为零
{
对于(n=1;n cout该类型被命名为uint64\u t
。uint32\u t
、uint16\u t
、uint8\u t
,等等
uint
不存在。您可能只是想unsigned int
您安装了64位编译器吗?您安装了什么版本的windows和什么版本的编译器?uint64\u t
是否命名了一种类型?。或者uint16\u t
或者uint32\u t
就这一点而言。uint64\u运行得很好,并且resz的ult是一致的,谢谢这里:uiny64被称为64位无符号整数。