#include <iostream>
#include <map>
#include <zlib.h>
#include <vector>
#include <stdint.h>
using namespace std;
int main (int argc, char **argv)
{
if(argc <2){ exit(0);}
//map<int, int> myMap;
struct last_touch
{
vector<uint64> baz;
uint32 foo;
uint32 bar;
}myLastTouch;
gzFile m_fHandle;
m_fHandle = gzopen(argv[1], "rb");
while(!gzeof(m_fHandle))
{
gzread(m_fHandle,&myLastTouch, sizeof(last_touch));
vector<uint64>::size_type sz = myLastTouch.baz.size();
cout<<"size \t"<<sz<<endl;
}
gzclose(m_fHandle);
}
我正在尝试从压缩文件中读取结构。
然后我使用g++ -lz test.cpp
In function ‘int main(int, char**)’:
test.cpp:15: error: ‘uint64’ was not declared in this scope
test.cpp:15: error: template argument 1 is invalid
test.cpp:15: error: template argument 2 is invalid
test.cpp:16: error: ‘uint32’ does not name a type
test.cpp:17: error: ‘uint32’ does not name a type
test.cpp:27: error: ‘uint64’ cannot appear in a constant-expression
test.cpp:27: error: template argument 1 is invalid
test.cpp:27: error: template argument 2 is invalid
test.cpp:27: error: expected initializer before ‘sz’
以下是我得到的错误。我认为uint32是因为<stdint.h>
而因此我加入了它。
还有其他一些我缺少的东西
答案 0 :(得分:3)
这些类型应该是_t
后缀:uint64_t