编译GDAL支持MySQL

时间:2023-10-29 13:21:02

GDAL支持MySQL需要MySQL的库才可以,编译很简单,修改nmake.opt文件中对应的MySQL的库的路径和lib即可。

nmake.opt文件中397行左右,如下:

# MySQL Libraries
# NOTE: Need /MT instead of /MD, also enable /EHsc switch.
#MYSQL_INC_DIR = D:\Software\MySQLServer4.1\include
#MYSQL_LIB = D:\Software\MySQLServer4.1\lib\opt\libmysql.lib advapi32.lib

修改为:

# MySQL Libraries
# NOTE: Need /MT instead of /MD, also enable /EHsc switch.
MYSQL_INC_DIR = F:\Work\GDAL\gdal_need\MySQL\include
MYSQL_LIB = F:\Work\GDAL\gdal_need\MySQL\lib\libmysql.lib advapi32.lib

然后重新编译即可。

需要注意的是,将MySQL的dll要拷贝到gdalxx.dll所在的目录。