Author Topic: unresolved external symbol  (Read 695 times)

0 Members and 1 Guest are viewing this topic.

Offline hreintke

unresolved external symbol
« on: March 01, 2017, 04:29:37 PM »
Setting up my development environment again.

Followed the compile instructions from the top of this board

Using Visual Studio Express 2012

Included :
OpenTTD file version 6
Pthread 2.9.1
Bzlib from the attachment of the message.

Double checked the library path includes -> should be OK too

Compiles OK but get errors when linking :

1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>image_reader.obj : error LNK2001: unresolved external symbol _adler32
1>loadsave.obj : error LNK2001: unresolved external symbol _gzeof
1>loadsave.obj : error LNK2001: unresolved external symbol _gzread
1>loadsave.obj : error LNK2001: unresolved external symbol _gzerror
1>loadsave.obj : error LNK2001: unresolved external symbol _gzwrite
1>loadsave.obj : error LNK2001: unresolved external symbol _gzclose
1>loadsave.obj : error LNK2001: unresolved external symbol _gzgets
1>loadsave.obj : error LNK2001: unresolved external symbol _gzopen
1>C:\Userdata\simutrans.git\Debug\Simutrans.exe : fatal error LNK1120: 8 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Anyone seen these and/or has a hint for a solution ?


Offline DrSuperGood

Re: unresolved external symbol
« Reply #1 on: March 01, 2017, 05:00:10 PM »
I think you are missing the zlib library. If you do have it, then make sure that the linker is set to use it (it might be set to use a differently named zlib library) and that the library is in your library path.

Personally I recommend self building all libraries except pthread with MSVC, however that requires some work and hacking around.

Offline hreintke

Re: unresolved external symbol
« Reply #2 on: March 01, 2017, 10:23:03 PM »
I do have the zlib directory for usage.

It is in the openttd essentials directory.
Also build form source and putting my compiled lib in the dir.

When I remove the zlibstat.lib, Visual Studio complains it cannot find the lib

I see the underscore in the missing functions, can that be a setting somewhere ?

Offline DrSuperGood

Re: unresolved external symbol
« Reply #3 on: March 02, 2017, 12:44:14 AM »
It is definitely a problem with zlib as those are zlib functions it cannot find. Not sure why there is an underscore there, I am guessing its some internal naming scheme that one is appended as a prefix.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8795
  • Total likes: 319
  • Helpful: 229
  • Languages: De,EN,JP
Re: unresolved external symbol
« Reply #4 on: March 02, 2017, 05:19:50 AM »
You might have to undefine ZLIB_STATIC or ZLIB_STAT in the preprocessor setting. The definitions I currently use are

NOMINMAX;WIN32_LEAN_AND_MEAN;WINVER=_WIN32_WINNT_WINXP;REVISION_FROM_FILE;DEBUG=3;COLOUR_DEPTH=16;MULTI_THREAD=2;%(PreprocessorDefinitions)

Offline hreintke

Re: unresolved external symbol
« Reply #5 on: March 02, 2017, 02:15:40 PM »
I had to add the ZLIB_WINAPI define to the project.

But after that still had a number of issues to solve.
Most probably due to the versions of libabries in the additional downloads needed.

Have it working now, will try to get  a clear view on what I did with which version and share the result.