一、准备资源
这里准备的是资源是编译过的gdal文件夹,下载解压后如下图所示:
二、配置过程
新建一个名为gdal_text的项目。
在附加选项中选中空项目。
2.1配置附加包含目录
2.2配置附加库目录
2.3配置附加依赖项
2.4配置环境变量
2.4测试
//C: / Users / CHENSHUAISHUAI / Pictures / Saved Pictures / 001.jpg
#include "gdal_priv.h"
#include<iostream>
using namespace std;
int main()
{
const char* pszFile;
GDALAllRegister();
pszFile = "C:/Users/CHENSHUAISHUAI/Pictures/Saved Pictures/001.jpg";
GDALDataset *poDataset = (GDALDataset*)GDALOpen(pszFile, GA_ReadOnly);
GDALRasterBand *poBand = poDataset->GetRasterBand(1);
int xsize = poBand->GetXSize();
int ysize = poBand->GetYSize();
cout << xsize << endl;
cout << ysize << endl;
system("pause");
return 0;
}
说明配置成功。