C++ 错误:整数常量上的后缀Ui64无效
我正试图建立和运行这个系统。我正在使用Windows8.1和MinGW以及GCC4.8.1版 这是log4z.cpp代码的一部分C++ 错误:整数常量上的后缀Ui64无效,c++,windows,gcc,mingw,C++,Windows,Gcc,Mingw,我正试图建立和运行这个系统。我正在使用Windows8.1和MinGW以及GCC4.8.1版 这是log4z.cpp代码的一部分 #include "log4z.h" #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <time.h> #include <string.h> #include <string> #include <ve
#include "log4z.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <sstream>
#include <iostream>
#include <fstream>
#include <algorithm>
#ifdef WIN32
#include <io.h>
#include <shlwapi.h>
#include <process.h>
#pragma comment(lib, "shlwapi")
#pragma warning(disable:4996)
#else
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include<pthread.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include <semaphore.h>
#endif
...
#ifdef WIN32
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
unsigned long long now = ft.dwHighDateTime;
now <<= 32;
now |= ft.dwLowDateTime;
now /=10;
now -=11644473600000000Ui64;
now /=1000;
pLog->_time = now/1000;
pLog->_precise = (unsigned int)(now%1000);
...
但是,我有一个带有Ubuntu 13.10和gcc版本4.8.1的虚拟机,它可以工作
我的问题是,我需要任何标志来向编译器指示它吗?我需要包括任何库吗?正如@Hans\u Passant所说,它可以通过ULL改变Ui64
now -=11644473600000000ULL;
此外,我发现了一些关于这方面的信息也许这有助于。。。请改用ULL后缀。您需要启用c++11:
-std=c++11
或-std=gnu++11
。Ui64是一个文本运算符。看见
now -=11644473600000000ULL;