VxWorks 6.8 的 zlib 编译错误
zlib compilation error with VxWorks 6.8
我正在尝试在 VxWorks 6.8 上使用 gzip 压缩功能。
VxWorks开发指南帮助中给出,
You can add the gzip compression feature to your system independently
of the Wind River Web Server by adding the zlib library files to your
project. To do so, add the files from
installDir/components/webcli-4.x/target/src/wrn/wm/common/zlib to your
project. Then use the -DWITH_ZLIB compiler flag when you build your
system.
我试过了,但出现构建错误
../zlib/zlib_adler32.cpp:21: error: 'z_uLong zlib_z_adler32' redeclared as different kind of symbol
../zlib/zlib.h:822: error: previous declaration of 'z_uLong zlib_z_adler32(z_uLong, const z_Bytef*, z_uInt)'
../zlib/zlib_adler32.cpp:25: error: expected unqualified-id before '{' token
C:\WindRiver\utilities-1.0\x86-win32\bin\make.exe: *** [.../zlib/zlib_adler32.o] Error 1
注意:文件的扩展名为.c,将其更改为.cpp 并使用C++ 编译器。函数用 extern "C"
声明
函数的声明可以是checked here
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
有线索吗?
问题出在 GNU C++ 不支持的 C 旧样式定义上
uLong ZEXPORT adler32(adler, buf, len)
uLong 阿德勒;
常量字节 *buf;
uInt len;
{...}
更正为
uLong ZEXPORT adler32(uLong adler, const Bytef * buf, uInt len) {...}
解决了我的问题。
我正在尝试在 VxWorks 6.8 上使用 gzip 压缩功能。
VxWorks开发指南帮助中给出,
You can add the gzip compression feature to your system independently of the Wind River Web Server by adding the zlib library files to your project. To do so, add the files from installDir/components/webcli-4.x/target/src/wrn/wm/common/zlib to your project. Then use the -DWITH_ZLIB compiler flag when you build your system.
我试过了,但出现构建错误
../zlib/zlib_adler32.cpp:21: error: 'z_uLong zlib_z_adler32' redeclared as different kind of symbol
../zlib/zlib.h:822: error: previous declaration of 'z_uLong zlib_z_adler32(z_uLong, const z_Bytef*, z_uInt)'
../zlib/zlib_adler32.cpp:25: error: expected unqualified-id before '{' token
C:\WindRiver\utilities-1.0\x86-win32\bin\make.exe: *** [.../zlib/zlib_adler32.o] Error 1
注意:文件的扩展名为.c,将其更改为.cpp 并使用C++ 编译器。函数用 extern "C"
声明函数的声明可以是checked here
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
有线索吗?
问题出在 GNU C++ 不支持的 C 旧样式定义上
uLong ZEXPORT adler32(adler, buf, len) uLong 阿德勒; 常量字节 *buf; uInt len; {...}
更正为 uLong ZEXPORT adler32(uLong adler, const Bytef * buf, uInt len) {...}
解决了我的问题。