Author Topic: Errors while compile: fatal error LNK1120 & fatal error LNK2001  (Read 4029 times)

0 Members and 1 Guest are viewing this topic.

imwilly37

  • Guest
I compiled it two weeks ago, and I have some errors while I compiled.

Three are some errors while I compiled.
Code: [Select]
1>------ 已開始建置: 專案: Simutrans, 組態: Debug Win32 ------
1>已經開始建置於 2013/5/6 上午 04:41:51。
1>InitializeBuildStatus:
1>  正在變更時間戳記 "Debug\Simutrans.unsuccessfulbuild"。
1>PreBuildEvent:
1>  Microsoft (R) Windows Script Host Version 5.8
1>  Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
1> 
1>  D:\Simutrans_source_code\aburch-simutrans-d005c8f\revision.jse(4, 1) WshShell.Exec: 系統找不到指定的檔案。
1> 
1> 
1>ClCompile:
1>  gameinfo.cc
1>  正在略過... (未偵測到相關變更)
1>  simworld.cc
1>  simsys_w.cc
1>  simmain.cc
1>  welt.cc
1>  settings_stats.cc
1>  server_frame.cc
1>  loadsave_frame.cc
1>  banner.cc
1>  umgebung.cc
1>  network_file_transfer.cc
1>  network_cmd_ingame.cc
1>  loadsave.cc
1>  所有輸出都是最新的。
1>ResourceCompile:
1>  所有輸出都是最新的。
1>ManifestResourceCompile:
1>  所有輸出都是最新的。
1>LINK : warning LNK4075: 忽略 '/INCREMENTAL',由於 '/LTCG' 規格
1>ai.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
1>ai.obj : error LNK2001: unresolved external symbol "struct __type_info_node __type_info_root_node" (?__type_info_root_node@@3U__type_info_node@@A)
1>ai.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall type_info::name(struct __type_info_node *)const " (?name@type_info@@QBEPBDPAU__type_info_node@@@Z)
1>ai.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z)
1>ai.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
1>ai.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
1>ai.obj : error LNK2001: unresolved external symbol _abs
1>ai.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
1>libcpmt.lib(newaop.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
1>ai_goods.obj : error LNK2001: unresolved external symbol _sprintf
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _sprintf
1>ai_goods.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *))" (??_M@YGXPAXIHP6EX0@Z@Z)
1>ai_goods.obj : error LNK2001: unresolved external symbol __wassert
1>ai_goods.obj : error LNK2001: unresolved external symbol _memset
1>ai_goods.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *))" (??_L@YGXPAXIHP6EX0@Z1@Z)
1>ai_passenger.obj : error LNK2001: unresolved external symbol _free
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _free
1>zlibstat.lib(zutil.obj) : error LNK2001: unresolved external symbol _free
1>api_city.obj : error LNK2001: unresolved external symbol _memcpy
1>api_city.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
1>api_city.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ)
1>api_city.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z)
1>api_city.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)
1>api_city.obj : error LNK2001: unresolved external symbol _memmove
1>api_city.obj : error LNK2001: unresolved external symbol _strlen
1>api_city.obj : error LNK2001: unresolved external symbol _atexit
1>libcpmt.lib(xlock.obj) : error LNK2001: unresolved external symbol _atexit
1>api_function.obj : error LNK2001: unresolved external symbol _memcmp
1>api_function.obj : error LNK2001: unresolved external symbol _fopen
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fopen
1>api_function.obj : error LNK2001: unresolved external symbol _fprintf
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fprintf
1>api_function.obj : error LNK2001: unresolved external symbol _fclose
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fclose
1>baum.obj : error LNK2001: unresolved external symbol _sqrt
1>baum.obj : error LNK2001: unresolved external symbol _pow
1>baum.obj : error LNK2001: unresolved external symbol _strcmp
1>bridge_reader.obj : error LNK2001: unresolved external symbol _fread
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fread
1>bruecke.obj : error LNK2001: unresolved external symbol "public: enum waytype_t __thiscall weg_besch_t::get_finance_waytype(void)const " (?get_finance_waytype@weg_besch_t@@QBE?AW4waytype_t@@XZ)
1>cbuffer_t.obj : error LNK2001: unresolved external symbol _strchr
1>cbuffer_t.obj : error LNK2001: unresolved external symbol _atoi
1>cbuffer_t.obj : error LNK2001: unresolved external symbol __vsprintf_p
1>citylist_stats_t.obj : error LNK2001: unresolved external symbol _abort
1>convoi_frame.obj : error LNK2001: unresolved external symbol _strstr
1>convoi_info_t.obj : error LNK2001: unresolved external symbol _strcat
1>csv.obj : error LNK2001: unresolved external symbol _strdup
1>OLDNAMES.lib(strdup.obj) : error LNK2001: unresolved external symbol _strdup
1>csv.obj : error LNK2001: unresolved external symbol _strpbrk
1>curiositylist_stats_t.obj : error LNK2001: unresolved external symbol _stricmp
1>OLDNAMES.lib(stricmp.obj) : error LNK2001: unresolved external symbol _stricmp
1>dynamic_string.obj : error LNK2001: unresolved external symbol _strcspn
1>einstellungen.obj : error LNK2001: unresolved external symbol _sscanf
1>einstellungen.obj : error LNK2001: unresolved external symbol _strcpy
1>einstellungen.obj : error LNK2001: unresolved external symbol _memchr
1>einstellungen.obj : error LNK2001: unresolved external symbol _printf
1>einstellungen.obj : error LNK2001: unresolved external symbol _exp
1>fabrikbauer.obj : error LNK2001: unresolved external symbol _fflush
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fflush
1>font.obj : error LNK2001: unresolved external symbol _feof
1>font.obj : error LNK2001: unresolved external symbol _calloc
1>zlibstat.lib(zutil.obj) : error LNK2001: unresolved external symbol _calloc
1>font.obj : error LNK2001: unresolved external symbol _malloc
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _malloc
1>font.obj : error LNK2001: unresolved external symbol _rewind
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _rewind
1>font.obj : error LNK2001: unresolved external symbol ___iob_func
1>font.obj : error LNK2001: unresolved external symbol _strtol
1>font.obj : error LNK2001: unresolved external symbol _fgets
1>font.obj : error LNK2001: unresolved external symbol _getc
1>gebaeude.obj : error LNK2001: unresolved external symbol _strncmp
1>gebaeude.obj : error LNK2001: unresolved external symbol _strrchr
1>gebaeude.obj : error LNK2001: unresolved external symbol _toupper
1>gui_chart.obj : error LNK2001: unresolved external symbol _log
1>gui_flowtext.obj : error LNK2001: unresolved external symbol _strncpy
1>gui_numberinput.obj : error LNK2001: unresolved external symbol _atol
1>help_frame.obj : error LNK2001: unresolved external symbol _ftell
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _ftell
1>help_frame.obj : error LNK2001: unresolved external symbol _fseek
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fseek
1>help_frame.obj : error LNK2001: unresolved external symbol _chdir
1>OLDNAMES.lib(chdir.obj) : error LNK2001: unresolved external symbol _chdir
1>loadsave.obj : error LNK2001: unresolved external symbol _strerror
1>loadsave.obj : error LNK2001: unresolved external symbol __errno
1>loadsave.obj : error LNK2001: unresolved external symbol _isdigit
1>loadsave.obj : error LNK2001: unresolved external symbol _ferror
1>loadsave.obj : error LNK2001: unresolved external symbol _fwrite
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fwrite
1>loadsave_frame.obj : error LNK2001: unresolved external symbol _strftime
1>loadsave_frame.obj : error LNK2001: unresolved external symbol __localtime64
1>loadsave_frame.obj : error LNK2001: unresolved external symbol __stat64i32
1>log.obj : error LNK2001: unresolved external symbol _vsprintf
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _vsprintf
1>log.obj : error LNK2001: unresolved external symbol _fputs
1>log.obj : error LNK2001: unresolved external symbol _vfprintf
1>network_cmd_ingame.obj : error LNK2001: unresolved external symbol _remove
1>network_file_transfer.obj : error LNK2001: unresolved external symbol _strnicmp
1>OLDNAMES.lib(strnicmp.obj) : error LNK2001: unresolved external symbol _strnicmp
1>obj_reader.obj : error LNK2001: unresolved external symbol _fgetc
1>searchfolder.obj : error LNK2001: unresolved external symbol __findnext64i32
1>searchfolder.obj : error LNK2001: unresolved external symbol __findfirst64i32
1>settings_stats.obj : error LNK2001: unresolved external symbol _log10
1>simgraph16.obj : error LNK2001: unresolved external symbol _access
1>OLDNAMES.lib(access.obj) : error LNK2001: unresolved external symbol _access
1>simgraph16.obj : error LNK2001: unresolved external symbol _puts
1>simgraph16.obj : error LNK2001: unresolved external symbol _exit
1>simmain.obj : error LNK2001: unresolved external symbol _getcwd
1>OLDNAMES.lib(getcwd.obj) : error LNK2001: unresolved external symbol _getcwd
1>simmem.obj : error LNK2001: unresolved external symbol _realloc
1>simsys.obj : error LNK2001: unresolved external symbol _mkdir
1>OLDNAMES.lib(mkdir.obj) : error LNK2001: unresolved external symbol _mkdir
1>simsys_w.obj : error LNK2001: unresolved external symbol ___argv
1>simsys_w.obj : error LNK2001: unresolved external symbol ___argc
1>simsys_w32_png.obj : error LNK2001: unresolved external symbol _wcscmp
1>simtools.obj : error LNK2001: unresolved external symbol _floor
1>simworld.obj : error LNK2001: unresolved external symbol _rename
1>sprachen.obj : error LNK2001: unresolved external symbol _atof
1>sqbaselib.obj : error LNK2001: unresolved external symbol _strtod
1>sqbaselib.obj : error LNK2001: unresolved external symbol _tolower
1>sqcompiler.obj : error LNK2001: unresolved external symbol _longjmp
1>sqlexer.obj : error LNK2001: unresolved external symbol _isalnum
1>sqlexer.obj : error LNK2001: unresolved external symbol _isalpha
1>sqlexer.obj : error LNK2001: unresolved external symbol _iscntrl
1>sqlexer.obj : error LNK2001: unresolved external symbol _strtoul
1>sqlexer.obj : error LNK2001: unresolved external symbol _isxdigit
1>sqstdmath.obj : error LNK2001: unresolved external symbol _atan2
1>sqstdmath.obj : error LNK2001: unresolved external symbol _cos
1>sqstdmath.obj : error LNK2001: unresolved external symbol _ceil
1>sqstdmath.obj : error LNK2001: unresolved external symbol _tan
1>sqstdmath.obj : error LNK2001: unresolved external symbol _rand
1>sqstdmath.obj : error LNK2001: unresolved external symbol _srand
1>sqstdmath.obj : error LNK2001: unresolved external symbol _acos
1>sqstdmath.obj : error LNK2001: unresolved external symbol _atan
1>sqstdmath.obj : error LNK2001: unresolved external symbol _fabs
1>sqstdmath.obj : error LNK2001: unresolved external symbol _asin
1>sqstdmath.obj : error LNK2001: unresolved external symbol _sin
1>sqstdrex.obj : error LNK2001: unresolved external symbol _isspace
1>sqstdrex.obj : error LNK2001: unresolved external symbol _ispunct
1>sqstdrex.obj : error LNK2001: unresolved external symbol _isprint
1>sqstdrex.obj : error LNK2001: unresolved external symbol _isupper
1>sqstdrex.obj : error LNK2001: unresolved external symbol _islower
1>sqstdstring.obj : error LNK2001: unresolved external symbol _strtok
1>sqstdsystem.obj : error LNK2001: unresolved external symbol __gmtime64
1>sqstdsystem.obj : error LNK2001: unresolved external symbol _system
1>sqstdsystem.obj : error LNK2001: unresolved external symbol _clock
1>sqstdsystem.obj : error LNK2001: unresolved external symbol _getenv
1>sqstdsystem.obj : error LNK2001: unresolved external symbol __time64
1>sqvm.obj : error LNK2001: unresolved external symbol _fmod
1>LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _errno
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol __chkstk
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol _fputc
1>zlibstat.lib(gzio.obj) : error LNK2001: unresolved external symbol __fdopen
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol __CxxThrowException@8
1>libcpmt.lib(stdhndlr.obj) : error LNK2001: unresolved external symbol "int (__cdecl*__cdecl _set_new_handler(int (__cdecl*)(unsigned int)))(unsigned int)" (?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z)
1>OLDNAMES.lib(strdup.obj) : error LNK2001: unresolved external symbol __strdup
1>OLDNAMES.lib(stricmp.obj) : error LNK2001: unresolved external symbol __stricmp
1>OLDNAMES.lib(chdir.obj) : error LNK2001: unresolved external symbol __chdir
1>OLDNAMES.lib(strnicmp.obj) : error LNK2001: unresolved external symbol __strnicmp
1>OLDNAMES.lib(access.obj) : error LNK2001: unresolved external symbol __access
1>OLDNAMES.lib(getcwd.obj) : error LNK2001: unresolved external symbol __getcwd
1>OLDNAMES.lib(mkdir.obj) : error LNK2001: unresolved external symbol __mkdir
1>D:\Simutrans_source_code\aburch-simutrans-d005c8f\Debug\Simutrans.exe : fatal error LNK1120: 138 unresolved external symbol
1>
1>建置失敗。
1>
1>經過時間 00:00:07.80
========== 建置: 0 成功、1 失敗、0 最新、0 略過 ==========


I have read some other topics.
1. Someone said that it caused by bad DLL files.I downloaded DLL files and put these files in my director where source code in.
2. Someone said that I should compile libbz2.lib myself. and i compiled this lib.

After I do above two steps, these errors didn't be fixed. So , I don't know what can I do to solve this problems.

Because my native language is not English(is traditional Chinese), maybe some steps or message I missed.
If there are some topics , or steps that I missed, please tell me.
Or someone know how can I fix this errors,please tell me,too.
Thanks.

imwilly37

  • Guest
Re: Errors while compile: fatal error LNK1120 & fatal error LNK2001
« Reply #1 on: May 06, 2013, 10:31:41 AM »
I compile success finally while I compile zlib.lib myself.

How could i delete this topic?

Offline Markohs

  • DevTeam, Coder/patcher
  • Devotee
  • *
  • Posts: 1559
  • Total likes: 2
  • Helpful: 86
  • Languages: EN,ES,CAT
Re: Errors while compile: fatal error LNK1120 & fatal error LNK2001
« Reply #2 on: May 06, 2013, 11:05:09 AM »
Hi imwilly37. Just let the thread open, we never (almost never) delete topics.

I'm glad you managed to fix it.

Well, anyway I'll tell you how I compile for teh case it helps anyone else too.

I just use this package: http://www.winimage.com/zLibDll/zlib125dll.zip (from http://www.winimage.com/zLibDll/index.html). The important thing (on the web already states that) when ussing that libs is you need to define  ZLIB_WINAPI in the project, or the link will fail. In VS you can do that in project properties, C++, preprocessorPreprocessor Definitions, add ZLIB_WINAPI.

 The problem in that package is that it doesn't include the .h , you have to download somewere else, http://gnuwin32.sourceforge.net/packages/zlib.htm for example and add the include directory to the project. About the library to link I like the static one, static32 directory, and link against zlibstat.lib. Those settings are in Linker - General - additional library directories and linker, input, additional dependencies