gpt4 book ai didi

c++ - 无法在 x64 中构建 gdal

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:53:27 26 4
gpt4 key购买 nike

我正在尝试在 x64 中构建 GDAL (1.9.2)。

在说明中,我看到:

# Uncomment the following if you are building for 64-bit windows
# (x64). You'll need to have PATH, INCLUDE and LIB set up for 64-bit
# compiles.
!IF "$(PLATFORM)" == "x64"
WIN64=YES
!ENDIF

然后,降低,

# Under win64, symbols for function names lack the underscore prefix
# present on win32. Also the STDCALL calling convention is not used.
!IFDEF WIN64
!UNDEF STDCALL
!ELSE
SYM_PREFIX=_
!ENDIF

找不到特定于 x64 的 PATH、INCLUDE 和 LIB,或者我应该做的任何其他事情...

我可以在 Win32 中构建。

在 x64 中,我遇到链接器错误:

LINK : error LNK2001: unresolved external symbol _OGRFeatureStylePuller
LINK : error LNK2001: unresolved external symbol _OSRValidate
...
gdal19.dll : fatal error LNK1120: 74 unresolved externals
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\BIN\link.EXE"' : return code '0x460'

我放(在 Win32 中构建)

!IFNDEF PLATFORM
PLATFORM=WIN32
!ENDIF

修改为

!IFNDEF PLATFORM
PLATFORM=x64
!ENDIF

(在 x64 中构建)- 它成功了。但前提是我从 Visual Studio 内部构建。

我希望能够使用 bat 文件(并构建所有平台/配置)上面 - 虽然它是在 VS 中构建的,但它不会从命令行构建(使用命令:

start /b /wait nmake -f makefile.vc clean
start /b /wait nmake.exe /f makefile.vc PLATFORM=x64
start /b /wait nmake.exe /f makefile.vc devinstall PLATFORM=x64

在 Win32 中构建完全相同的东西...

我不知道哪里出了问题......

最佳答案

我使用 http://dominoc925.blogspot.ru/2013/03/build-64-bit-gdal-for-windows.html 中的步骤在 Visual Studio 2012 下成功构建了 GDAL 的 x64 版本:

  1. http://download.osgeo.org/gdal/下载gdal-1.9.2.tar.gz(或其他版本的源)
  2. 解压到某个目录,例如C:\tmp\gdal-1.9.2\

    如果您之前尝试构建 GDAL(例如 x86),请确保构建目录 (C:\warmerda\bld\) 和源目录与之前的构建尝试相比是干净的。如果不确定,请尝试在新目录中解压源代码。

  3. 启动 VS2012 x64 Native Tools 命令提示符:开始 -> 所有程序 -> Microsoft Visual Studio 2012 -> Visual Studio 工具 -> 打开 VS2012 x64 native 工具命令提示符

    或者运行%comspec%/k "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"amd64).

  4. 将目录更改为包含解压的 GDAL 源的目录:

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>cd /D C:\tmp\gdal-1.9.2

    D:\trn4\gdal-1.9.2>
  5. 使用开发文件构建 GDAL:

    nmake /f makefile.vc MSVC_VER=1700 WIN64=YES
    nmake /f makefile.vc MSVC_VER=1700 WIN64=YES install
    nmake /f makefile.vc MSVC_VER=1700 WIN64=YES devinstall

您可以从 here 中获取您的 MSVC_VER 编号. GDAL 将构建并安装到 C:\warmerda\bld\

关于c++ - 无法在 x64 中构建 gdal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16526181/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com