[gdal-dev] Building Gdal with C++ Visual Studio 2019 - Error Linking.

Carl Godkin cgodkin at gmail.com
Thu Nov 11 17:00:41 PST 2021


Hi Peter,

I think you'll have to tell us how you tried to build GDAL in order to get
more help.  There is a lot of variability, but here's how I recently built
both of the versions you mention:

First, I create a file I called "win64.opt" that looks like this:
-----8<--------------------------------------------
WIN64=YES

GDAL_HOME = d:\gdal-3.4.0
BINDIR = $(GDAL_HOME)\bin64
PLUGINDIR = $(BINDIR)\gdalplugins64
LIBDIR = $(GDAL_HOME)\lib64

OPENSSL_PATH=D:\openssl-1.1.1e
SSLLIBS = $(OPENSSL_PATH)/lib/libcrypto.lib $(OPENSSL_PATH)/lib/libssl.lib

CURL_DIR = d:\curl-7.69.1
CURL_INC = -I$(CURL_DIR)\include
CURL_LIB = $(CURL_DIR)\lib\libcurl_imp.lib $(SSLLIBS) wsock32.lib
wldap32.lib winmm.lib

PROJ_INCLUDE = -Id:\proj-8.1.1\include
PROJ_LIBRARY = d:\proj-8.1.1\lib\proj.lib shell32.lib ole32.lib

SQLITE_INC = -Id:\sqlite-3.28.0
SQLITE_LIB = d:\sqlite-3.28.0\sqlite3.lib
-----8<--------------------------------------------
Note that you'll have to build PROJ ahead of time first and adjust the
above depending on where you install it.

Then I build from the VS2019 command prompt with a command line like this
nmake -f makefile.vc EXT_NMAKE_OPT=win64.opt devinstall

If you just want the binaries and don't plan to build against GDAL, you can
use plain "install" instead.

(Note that the PROJ and GDAL worlds are moving to Cmake but the above has
worked for me for many years.)

Hope that helps,
carl


On Thu, Nov 11, 2021 at 2:39 PM peter vG via gdal-dev <
gdal-dev at lists.osgeo.org> wrote:

> I've been trying to build the binaries for Gdal 3.3.3 (and 3.4.0) using
> Visual C++ (via Visual Studio 2019), but I am getting a linking error that
> has me scratching my head: LINK : "fatal error LNK1104: cannot open file
> 'C:\gdal-3.4.0\lib.obj'". What is lib.obj? I am new to Visual C++, having
> come from the CPP Builder world, so I'm still getting my head around this
> product. Any suggestions would be greatly appreciated as I am wasting my
> life trying to hunt down a solution!
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211111/859a003b/attachment.html>


More information about the gdal-dev mailing list