当前位置: 技术问答>linux和unix
请问一下小问题
来源: 互联网 发布时间:2015-09-26
本文导语: /*test.cpp*/ #include #include int main() { Bytef t[1024*600]; gzFile gzF = gzopen("c:/temp.zip","rb"); int aaaaaa = gzread(gzF,t,1024*600); gzclose(gzF); FILE * pf = fopen("C:/index.html",...
/*test.cpp*/
#include
#include
int main()
{
Bytef t[1024*600];
gzFile gzF = gzopen("c:/temp.zip","rb");
int aaaaaa = gzread(gzF,t,1024*600);
gzclose(gzF);
FILE * pf = fopen("C:/index.html","wb");
fseek(pf,0,SEEK_SET);
fwrite(t,1,aaaaaa,pf);
fclose(pf);
return 0;
}
有上面这么一段小程序,g++ -o test test.cpp出现以下一些错误
/tmp/ccSt4XvN.o(.text+0x21): In function `main':
: undefined reference to `gzopen'
/tmp/ccSt4XvN.o(.text+0x44): In function `main':
: undefined reference to `gzread'
/tmp/ccSt4XvN.o(.text+0x5b): In function `main':
: undefined reference to `gzclose'
collect2: ld ret
urned 1 exit status
请教如何解决
#include
#include
int main()
{
Bytef t[1024*600];
gzFile gzF = gzopen("c:/temp.zip","rb");
int aaaaaa = gzread(gzF,t,1024*600);
gzclose(gzF);
FILE * pf = fopen("C:/index.html","wb");
fseek(pf,0,SEEK_SET);
fwrite(t,1,aaaaaa,pf);
fclose(pf);
return 0;
}
有上面这么一段小程序,g++ -o test test.cpp出现以下一些错误
/tmp/ccSt4XvN.o(.text+0x21): In function `main':
: undefined reference to `gzopen'
/tmp/ccSt4XvN.o(.text+0x44): In function `main':
: undefined reference to `gzread'
/tmp/ccSt4XvN.o(.text+0x5b): In function `main':
: undefined reference to `gzclose'
collect2: ld ret
urned 1 exit status
请教如何解决
|
加上 -lz