【发布时间】:2012-08-29 21:51:41
【问题描述】:
是否有人在 Visual Studio 2010 上成功编译了 Maxmind C 库?我无法在 Windows 上编译它,因为我收到很多关于 unistd.h 等未找到文件的错误
【问题讨论】:
标签: c++ visual-studio-2010 geoip
是否有人在 Visual Studio 2010 上成功编译了 Maxmind C 库?我无法在 Windows 上编译它,因为我收到很多关于 unistd.h 等未找到文件的错误
【问题讨论】:
标签: c++ visual-studio-2010 geoip
您看到的错误可能是因为您包含了并非真正需要的 GeoIPUpdate。 GeoIPUpdate 是用于更新数据库的独立脚本,不需要使用 API 本身。尝试删除它,看看是否能解决您的问题。
此外,为了在 Visual Studio 2005 上为我编译 1.4.8 版,我必须执行以下附加步骤:
#define ssize_t long
PACKAGE_VERSION 更改为“1.4.8”static const。将tmp_fixed_record 的定义更改为
unsigned char tmp_fixed_record[6+4]; //Can't use CITYCONFIDENCEDIST_FIXED_RECORD in declaration
_extract_record() 的开头声明 t。pread 未定义。将以下定义添加到每个文件中:#define pread my_pread
static size_t my_pread( int file_no, void *buffer, size_t size, size_t offset )
{
if (_lseek( file_no, (long)offset, SEEK_SET) == offset)
return _read(file_no, buffer, (int)size);
else
return -1L;
}
此外,将#include <io.h> 添加到GeoIP.h,以便包含_lseek 和_read。
【讨论】: