Compiler errors. lnk2001 lnk1120

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Compiler errors. lnk2001 lnk1120

Post by kingrein »

Hey all,
since a really long time ive finally been able to patch openttd, now im trying to compile it for about 3 days.
yet no succes, because i get errors every time the compiler starts linking. im using visual studios 2008 express. (also tried it with 2012)

Code: Select all

5>Linking...
5>debug.obj : error LNK2001: unresolved external symbol __imp__send@16
5>network.obj : error LNK2001: unresolved external symbol __imp__accept@12
5>network.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
5>network.obj : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
5>network.obj : error LNK2001: unresolved external symbol __imp__setsockopt@20
5>network.obj : error LNK2001: unresolved external symbol __imp__select@20
5>network.obj : error LNK2001: unresolved external symbol __imp__ioctlsocket@12
5>address.obj : error LNK2001: unresolved external symbol __imp__listen@8
5>address.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
5>address.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
5>address.obj : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
5>address.obj : error LNK2001: unresolved external symbol __imp__getservbyname@8
5>address.obj : error LNK2001: unresolved external symbol __imp__socket@12
5>address.obj : error LNK2001: unresolved external symbol __imp__bind@12
5>address.obj : error LNK2001: unresolved external symbol __imp__getservbyport@8
5>address.obj : error LNK2001: unresolved external symbol __imp__ntohs@4
5>address.obj : error LNK2001: unresolved external symbol __imp__htons@4
5>address.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
5>address.obj : error LNK2001: unresolved external symbol __imp__htonl@4
5>address.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
5>address.obj : error LNK2001: unresolved external symbol __imp__inet_ntoa@4
5>address.obj : error LNK2001: unresolved external symbol __imp__connect@12
5>core.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
5>core.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
5>host.obj : error LNK2001: unresolved external symbol __imp__WSAIoctl@36
5>tcp.obj : error LNK2001: unresolved external symbol __imp__recv@16
5>udp.obj : error LNK2001: unresolved external symbol __imp__sendto@24
5>udp.obj : error LNK2001: unresolved external symbol __imp__recvfrom@24
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__mciSendStringA@16
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__mciSendStringW@16
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutSetVolume@8
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutGetNumDevs@0
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutGetDevCapsW@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutPrepareHeader@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutOpen@24
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutUnprepareHeader@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutReset@4
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutWrite@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutClose@4
5>..\objs\Win32\Release\\openttd.exe : fatal error LNK1120: 39 unresolved externals
could anyone help me with finding out how to solve this?
i used https://wiki.openttd.org/Microsoft_Visu ... press_2008 as guide.
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiler errors. lnk2001 lnk1120

Post by planetmaker »

Please compile and build an unpatched OpenTTD as the first thing. Also make sure you have openttd-useful installed properly when compiling on windows: https://www.openttd.org/en/download-openttd-useful
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Code: Select all

1>------ Skipped Build: Project: generate, Configuration: Debug Win32 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: version, Configuration: Debug Win32 ------
3>------ Build started: Project: langs, Configuration: Debug Win32 ------
2>Determining version number
3>Generating strings.h
2>Microsoft (R) Windows Script Host versie 5.8
2>Copyright (C) Microsoft Corporation. Alle rechten voorbehouden.
3>Build log was saved at "file://c:\Users\reinn_000\Desktop\penttd\trunk\objs\langs\BuildLog.htm"
3>langs - 0 error(s), 0 warning(s)
2>Build log was saved at "file://c:\Users\reinn_000\Desktop\penttd\trunk\projects\Debug\BuildLog.htm"
2>version - 0 error(s), 0 warning(s)
4>------ Build started: Project: openttd, Configuration: Release Win32 ------
4>Linking...
4>LINK : fatal error LNK1181: cannot open input file 'libicu.lib'
4>Build log was saved at "file://c:\Users\reinn_000\Desktop\penttd\trunk\objs\Win32\Release\BuildLog.htm"
4>openttd - 1 error(s), 0 warning(s)
========== Build: 2 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========
redo-ing the built with a clean solution

edit:

Code: Select all

5>cargopacket.cpp
5>bmp.cpp
5>autoreplace.cpp
5>articulated_vehicles.cpp
5>animated_tile.cpp
5>airport.cpp
5>Compiling resources...
5>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
5>Copyright (C) Microsoft Corporation.  All rights reserved.
5>Linking...
5>LINK : fatal error LNK1181: cannot open input file 'libicu.lib'
5>Creating browse information file...
5>Microsoft Browse Information Maintenance Utility Version 9.00.30729
5>Copyright (C) Microsoft Corporation. All rights reserved.
5>Build log was saved at "file://c:\Users\reinn_000\Desktop\penttd\trunk\objs\Win32\Release\BuildLog.htm"
5>openttd - 1 error(s), 5 warning(s)
========== Build: 3 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
same story with the clean solution... btw, this is using a clean non-patched openttd r20009 (thats because i also use that revision for the patches)
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiler errors. lnk2001 lnk1120

Post by planetmaker »

That tells a completely different story! You are missing libicu.
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

but.. that would mean that i never got libicu in the first place xD

edit:
they dont even speak about it in the guide xD

Edit2:
is there a place where i can get the libicu file?
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Compiler errors. lnk2001 lnk1120

Post by adf88 »

ICU is included into openttd-usefull. Make sure you installed it correctly: https://wiki.openttd.org/Microsoft_Visu ... _libraries
:] don't worry, be happy and checkout my patches
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Well, i had a look again in that folder.... About 3 times, also had a look in the zip file, also multiple times.... No libicu/icu around... Dont know why
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Compiler errors. lnk2001 lnk1120

Post by Alberth »

kingrein wrote:Well, i had a look again in that folder.... About 3 times, also had a look in the zip file, also multiple times.... No libicu/icu around... Dont know why
Huh, weird, grep can find it...

Code: Select all

$ unzip -l openttd-useful-5.1-win.zip | grep -i icu
    17943  03-15-2013 16:16   OpenTTD essentials/licenses/icu-license.html
      938  05-23-2013 13:01   OpenTTD essentials/shared/include/unicode/icudataver.h
    11770  05-23-2013 13:01   OpenTTD essentials/shared/include/unicode/icuplug.h
  7405862  06-27-2013 23:13   OpenTTD essentials/win32/library/icudt.lib
 19118692  06-27-2013 23:11   OpenTTD essentials/win32/library/icuin.lib
   431858  06-27-2013 23:13   OpenTTD essentials/win32/library/icuio.lib
  3002180  06-27-2013 23:13   OpenTTD essentials/win32/library/icule.lib
   441428  06-27-2013 23:13   OpenTTD essentials/win32/library/iculx.lib
 11823838  06-27-2013 22:11   OpenTTD essentials/win32/library/icuuc.lib
  7405858  06-27-2013 22:10   OpenTTD essentials/win64/library/icudt.lib
 21006188  06-27-2013 22:26   OpenTTD essentials/win64/library/icuin.lib
   481980  06-27-2013 22:26   OpenTTD essentials/win64/library/icuio.lib
  3133304  06-27-2013 22:26   OpenTTD essentials/win64/library/icule.lib
   459774  06-27-2013 23:14   OpenTTD essentials/win64/library/iculx.lib
 12906022  06-27-2013 22:24   OpenTTD essentials/win64/library/icuuc.lib
Ie don't trust eyes when searching, use a computer :)
Being a retired OpenTTD developer does not mean I know what I am doing.
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Ill download it again when i can get behind my pc... Probably tomorrow...
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiler errors. lnk2001 lnk1120

Post by planetmaker »

There's a difference between 'libicu.lib' and 'icuXX.lib'. But that likely is somewhere a configuration issue
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Is it also possible to compile without using libicu? So, telling the compiler not to look for those thus ignoring them?
if so, how and could this result in further complications

edit:
found a place to download an older openttd-usefull since i use an older revision, in this zip file there was an libicu.lib so i have that error fixed (jeej)

now im getting these bullies:

Code: Select all

articulated_vehicles.cpp
5>animated_tile.cpp
5>airport.cpp
5>Compiling resources...
5>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
5>Copyright (C) Microsoft Corporation.  All rights reserved.
5>Linking...
5>debug.obj : error LNK2001: unresolved external symbol __imp__send@16
5>network.obj : error LNK2001: unresolved external symbol __imp__accept@12
5>network.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
5>network.obj : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
5>network.obj : error LNK2001: unresolved external symbol __imp__setsockopt@20
5>network.obj : error LNK2001: unresolved external symbol __imp__select@20
5>network.obj : error LNK2001: unresolved external symbol __imp__ioctlsocket@12
5>address.obj : error LNK2001: unresolved external symbol __imp__listen@8
5>address.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
5>address.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
5>address.obj : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
5>address.obj : error LNK2001: unresolved external symbol __imp__getservbyname@8
5>address.obj : error LNK2001: unresolved external symbol __imp__socket@12
5>address.obj : error LNK2001: unresolved external symbol __imp__bind@12
5>address.obj : error LNK2001: unresolved external symbol __imp__getservbyport@8
5>address.obj : error LNK2001: unresolved external symbol __imp__ntohs@4
5>address.obj : error LNK2001: unresolved external symbol __imp__htons@4
5>address.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
5>address.obj : error LNK2001: unresolved external symbol __imp__htonl@4
5>address.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
5>address.obj : error LNK2001: unresolved external symbol __imp__inet_ntoa@4
5>address.obj : error LNK2001: unresolved external symbol __imp__connect@12
5>core.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
5>core.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
5>host.obj : error LNK2001: unresolved external symbol __imp__WSAIoctl@36
5>tcp.obj : error LNK2001: unresolved external symbol __imp__recv@16
5>udp.obj : error LNK2001: unresolved external symbol __imp__sendto@24
5>udp.obj : error LNK2001: unresolved external symbol __imp__recvfrom@24
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__mciSendStringA@16
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__mciSendStringW@16
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutSetVolume@8
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutGetNumDevs@0
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutGetDevCapsW@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutPrepareHeader@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutOpen@24
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutUnprepareHeader@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutReset@4
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutWrite@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutClose@4
5>..\objs\Win32\Release\\openttd.exe : fatal error LNK1120: 39 unresolved externals
5>Creating browse information file...
5>Microsoft Browse Information Maintenance Utility Version 9.00.30729
5>Copyright (C) Microsoft Corporation. All rights reserved.
5>Build log was saved at "file://c:\Users\reinn_000\Desktop\penttd2\trunk\objs\Win32\Release\BuildLog.htm"
5>openttd - 40 error(s), 5 warning(s)
========== Rebuild All: 3 succeeded, 1 failed, 1 skipped ==========
again, this is the clean openttd source.

edit:
i cleaned the solution once again, and compiled it.... it worked... now i have a functioning clean openttd... now moved back to the patched one... attempt 1 of today: failed... cleaned solution, tried again: once again

Code: Select all

>Compiling resources...
5>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
5>Copyright (C) Microsoft Corporation.  All rights reserved.
5>Linking...
5>debug.obj : error LNK2001: unresolved external symbol __imp__send@16
5>network.obj : error LNK2001: unresolved external symbol __imp__accept@12
5>network.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
5>network.obj : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
5>network.obj : error LNK2001: unresolved external symbol __imp__setsockopt@20
5>network.obj : error LNK2001: unresolved external symbol __imp__select@20
5>network.obj : error LNK2001: unresolved external symbol __imp__ioctlsocket@12
5>address.obj : error LNK2001: unresolved external symbol __imp__listen@8
5>address.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
5>address.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
5>address.obj : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
5>address.obj : error LNK2001: unresolved external symbol __imp__getservbyname@8
5>address.obj : error LNK2001: unresolved external symbol __imp__socket@12
5>address.obj : error LNK2001: unresolved external symbol __imp__bind@12
5>address.obj : error LNK2001: unresolved external symbol __imp__getservbyport@8
5>address.obj : error LNK2001: unresolved external symbol __imp__ntohs@4
5>address.obj : error LNK2001: unresolved external symbol __imp__htons@4
5>address.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
5>address.obj : error LNK2001: unresolved external symbol __imp__htonl@4
5>address.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
5>address.obj : error LNK2001: unresolved external symbol __imp__inet_ntoa@4
5>address.obj : error LNK2001: unresolved external symbol __imp__connect@12
5>core.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
5>core.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
5>host.obj : error LNK2001: unresolved external symbol __imp__WSAIoctl@36
5>tcp.obj : error LNK2001: unresolved external symbol __imp__recv@16
5>udp.obj : error LNK2001: unresolved external symbol __imp__sendto@24
5>udp.obj : error LNK2001: unresolved external symbol __imp__recvfrom@24
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__mciSendStringA@16
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__mciSendStringW@16
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutSetVolume@8
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutGetNumDevs@0
5>win32_m.obj : error LNK2001: unresolved external symbol __imp__midiOutGetDevCapsW@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutPrepareHeader@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutOpen@24
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutUnprepareHeader@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutReset@4
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutWrite@12
5>win32_s.obj : error LNK2001: unresolved external symbol __imp__waveOutClose@4
5>..\objs\Win32\Release\\openttd.exe : fatal error LNK1120: 39 unresolved externals
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Compiler errors. lnk2001 lnk1120

Post by adf88 »

kingrein wrote:btw, this is using a clean non-patched openttd r20009 (thats because i also use that revision for the patches)
At that time OpenTTD was using version 3.1 of the openttd-useful. Try this one.
Setup VS using the above version of openttd-useful. Download a clean solution and build it. Then apply the patch and rebuild the solution.
:] don't worry, be happy and checkout my patches
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Still have those lnk2001 errors... Got the clean source compiled again... Once patched problems arose
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiler errors. lnk2001 lnk1120

Post by planetmaker »

kingrein wrote:Still have those lnk2001 errors... Got the clean source compiled again... Once patched problems arose
If unpatched OpenTTD compiles and patched OpenTTD fails to link, then it's clearly an issue with the patch :)
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Compiler errors. lnk2001 lnk1120

Post by Eddi »

try running projects\generate[.vbs] after patching, some patches forget this (because they were written/tested with Linux or MinGW), and then MSVC will not see/compile the new files
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

but could that be the cause of these lnk errors?

Edit; wanted to try it this afternoon, but as soon as i open de solution file with mcsv, mcvs crashes.... Currently busy with figuring out whats wrong with it.
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Sorry for double post... But got it working somehow... It compiled, tested it and it worked... Only weird thing, some of the newgrfs i use, can be downloaded but after apllying them, they wont show up ingame....
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Compiler errors. lnk2001 lnk1120

Post by Alberth »

You downloaded a NewGRF, added it to the list from the main menu, and loaded a game?
Yes, they don't show up there. That's normal and intended. You have to start a new game to get the new NewGRF configuration.
Being a retired OpenTTD developer does not mean I know what I am doing.
kingrein
Engineer
Engineer
Posts: 37
Joined: 12 Feb 2013 14:40
Location: somewhere on this world where they speak Dutch.

Re: Compiler errors. lnk2001 lnk1120

Post by kingrein »

Im not that stupid... I know i have to start a new game... I kinda grew up with ttd and since about 5years openttd..
Maybe you should try something else, or at least, think in a different way. like someone with autism, it could be usefull.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Compiler errors. lnk2001 lnk1120

Post by Alberth »

Well, sorry then. It's just a common mistake of new forum users.
Being a retired OpenTTD developer does not mean I know what I am doing.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 50 guests