zlib and minizip linking errors - visual-c++

My project requires me to have an unzipping functionality in C++ common for both Windows and Mac. I tried a source code from the internet which includes zlib library I am not sure if this will work for Mac), but I am getting a lot of linking errors.
1>------ Build started: Project: ZipFile, Configuration: Debug Win32 ------
1> zipper.cpp
1> ZipFile.cpp
1> unzipper.cpp
1> stdafx.cpp
1> Generating Code...
1>unzipper.obj : error LNK2019: unresolved external symbol _unzOpen64 referenced in function "public: bool __thiscall ziputils::unzipper::open(char const *)" (?open#unzipper#ziputils##QAE_NPBD#Z)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzClose referenced in function "public: void __thiscall ziputils::unzipper::close(void)" (?close#unzipper#ziputils##QAEXXZ)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzGetGlobalInfo64 referenced in function "private: void __thiscall ziputils::unzipper::readEntries(void)" (?readEntries#unzipper#ziputils##AAEXXZ)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzGoToNextFile referenced in function "private: void __thiscall ziputils::unzipper::readEntries(void)" (?readEntries#unzipper#ziputils##AAEXXZ)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzLocateFile referenced in function "public: bool __thiscall ziputils::unzipper::openEntry(char const *)" (?openEntry#unzipper#ziputils##QAE_NPBD#Z)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzGetCurrentFileInfo64 referenced in function "public: unsigned int __thiscall ziputils::unzipper::getEntrySize(void)" (?getEntrySize#unzipper#ziputils##QAEIXZ)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzOpenCurrentFile referenced in function "public: bool __thiscall ziputils::unzipper::openEntry(char const *)" (?openEntry#unzipper#ziputils##QAE_NPBD#Z)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzCloseCurrentFile referenced in function "public: void __thiscall ziputils::unzipper::closeEntry(void)" (?closeEntry#unzipper#ziputils##QAEXXZ)
1>unzipper.obj : error LNK2019: unresolved external symbol _unzReadCurrentFile referenced in function "public: class ziputils::unzipper & __thiscall ziputils::unzipper::operator>>(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??5unzipper#ziputils##QAEAAV01#AAV?$basic_ostream#DU?$char_traits#D#std###std###Z)
1>zipper.obj : error LNK2019: unresolved external symbol _zipOpen64 referenced in function "public: bool __thiscall ziputils::zipper::open(char const *,bool)" (?open#zipper#ziputils##QAE_NPBD_N#Z)
1>zipper.obj : error LNK2019: unresolved external symbol _zipOpenNewFileInZip referenced in function "public: bool __thiscall ziputils::zipper::addEntry(char const *)" (?addEntry#zipper#ziputils##QAE_NPBD#Z)
1>zipper.obj : error LNK2019: unresolved external symbol _zipWriteInFileInZip referenced in function "public: class ziputils::zipper & __thiscall ziputils::zipper::operator<<(class std::basic_istream<char,struct std::char_traits<char> > &)" (??6zipper#ziputils##QAEAAV01#AAV?$basic_istream#DU?$char_traits#D#std###std###Z)
1>zipper.obj : error LNK2019: unresolved external symbol _zipCloseFileInZip referenced in function "public: void __thiscall ziputils::zipper::closeEntry(void)" (?closeEntry#zipper#ziputils##QAEXXZ)
1>zipper.obj : error LNK2019: unresolved external symbol _zipClose referenced in function "public: void __thiscall ziputils::zipper::close(void)" (?close#zipper#ziputils##QAEXXZ)
1>c:\users\ashraya\documents\visual studio 2015\Projects\ZipFile\Debug\ZipFile.exe : fatal error LNK1120: 14 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have added zlib.lib and zlibstatic.lib compiled for x86 platform in debug mode (and release mode respectively) in Linker->Input->Additional Dependencies
Added the paths to the include directories in Linker->General->Additional Library Directories
Added the same include paths in C/C++ ->General->Additional Include Directories
I am nore sure where I am going wrong. I read other posts in the internet and found that I need to add
#ifdef _WIN32
#define ZLIB_WINAPI
#endif
for windows. But I am not sure if the code will compile in Mac since this flag will not be valid for Mac. Anyways, adding the flag didn't solve the linking errors. The errors seem to be from Minizip but I am not able to resolve them.
Can anyone please help?
Thanks a lot, in advance.
Esash

The minizip source code is in the contrib/minizip directory in the zlib distribution. It looks like you need to compile that along with zlib.

Related

Linking iostream to Visual Studio 2017

After trying to build this simple program:
#include <iostream>
#include <cstdlib>
using namespace std;
void main()
{
int a = 6;
cout << a << endl;
}
I get many "unresolved external symbol" errors:
LNK1120 12 unresolved external errors
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol strcat_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure##YAXPEAXPEBD#Z) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_error_.obj) 1
Error LNK2019 unresolved external symbol strcpy_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure##YAXPEAXPEBD#Z) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_error_.obj) 1
Error LNK2019 unresolved external symbol wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath##YAHPEB_WPEA_W_K#Z) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_pdblkup_.obj) 1
Error LNK2019 unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_init_.obj) 1
Error LNK2019 unresolved external symbol _CrtDbgReportW referenced in function _CRT_RTC_INITW CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_init_.obj) 1
Error LNK2019 unresolved external symbol _wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath##YAHPEB_WPEA_W_K#Z) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_pdblkup_.obj) 1
Error LNK2019 unresolved external symbol _wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath##YAHPEB_WPEA_W_K#Z) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_pdblkup_.obj) 1
Error LNK2001 unresolved external symbol __C_specific_handler CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_error_.obj) 1
Error LNK2019 unresolved external symbol __stdio_common_vsprintf_s referenced in function _vsprintf_s_l CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_error_.obj) 1
Error LNK2019 unresolved external symbol __vcrt_GetModuleFileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPEAUHINSTANCE__##XZ) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_pdblkup_.obj) 1
Error LNK2019 unresolved external symbol __vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPEAUHINSTANCE__##XZ) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_pdblkup_.obj) 1
Error LNK2019 unresolved external symbol __vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPEAUHINSTANCE__##XZ) CPP C:Documents\VSCPP\CPP\CPP\MSVCRTD.lib(_pdblkup_.obj) 1
What is causing this and how this can be fixed?

iGraph 0.7.1 - C library - msvc | Build fails when invoking igraph_betweenness(...)

Thanks to this blog post I was able to build igraph.lib with msvc. Simple tutorial examples work, however, if I use the method igraph_betweenness(...), I get the following build errors. I can build and run my program without errors on Linux.
igraph.lib(prpack.obj):-1: error: LNK2019: unresolved external symbol "public: __cdecl prpack::prpack_base_graph::~prpack_base_graph(void)" (??1prpack_base_graph#prpack##QEAA#XZ) referenced in function "public: __cdecl prpack::prpack_igraph_graph::~prpack_igraph_graph(void)" (??1prpack_igraph_graph#prpack##QEAA#XZ)
igraph.lib(prpack.obj):-1: error: LNK2019: unresolved external symbol "public: __cdecl prpack::prpack_igraph_graph::prpack_igraph_graph(struct igraph_s const *,struct igraph_vector_t const *,int)" (??0prpack_igraph_graph#prpack##QEAA#PEBUigraph_s##PEBUigraph_vector_t##H#Z) referenced in function igraph_personalized_pagerank_prpack
igraph.lib(prpack.obj):-1: error: LNK2019: unresolved external symbol "public: __cdecl prpack::prpack_result::~prpack_result(void)" (??1prpack_result#prpack##QEAA#XZ) referenced in function "public: void * __cdecl prpack::prpack_result::`scalar deleting destructor'(unsigned int)" (??_Gprpack_result#prpack##QEAAPEAXI#Z)
igraph.lib(prpack.obj):-1: error: LNK2019: unresolved external symbol "public: __cdecl prpack::prpack_solver::prpack_solver(class prpack::prpack_base_graph *,bool)" (??0prpack_solver#prpack##QEAA#PEAVprpack_base_graph#1#_N#Z) referenced in function igraph_personalized_pagerank_prpack
igraph.lib(prpack.obj):-1: error: LNK2019: unresolved external symbol "public: __cdecl prpack::prpack_solver::~prpack_solver(void)" (??1prpack_solver#prpack##QEAA#XZ) referenced in function igraph_personalized_pagerank_prpack
igraph.lib(prpack.obj):-1: error: LNK2019: unresolved external symbol "public: class prpack::prpack_result * __cdecl prpack::prpack_solver::solve(double,double,double const *,double const *,char const *)" (?solve#prpack_solver#prpack##QEAAPEAVprpack_result#2#NNPEBN0PEBD#Z) referenced in function igraph_personalized_pagerank_prpack

LNK2019 - visual studio 2013 - error despite having defined all symbols

I have a Win32 Console Application project in Visual Studio 2013. I've set up the project to work with OpenCV 2.4.9. I'm also using PGRFlyCapture SDK (http://ww2.ptgrey.com/sdk/flycap), so I have configured the paths for include,bin,lib for this sdk.
There's a header file that I've created, along with a .cpp file to define all the function prototypes declared in the header file. Despite that, I'm getting the LNK2019 unresolved external symbol error.
I need help getting rid of these LNK2019 errors.
Would like a link to the PGRFlyCapture SDK as I didn't find it, maybe I've configured the SDK with the project in Visual Studio incorrectly.
Posting the error list for reference.
Error 21 error LNK1120: 20 unresolved externals C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\Debug\VideoGrabber_V3.exe VideoGrabber_V3
Error 1 error LNK2001: unresolved external symbol "const FlyCapture2::CameraBase::`vftable'" (??_7CameraBase#FlyCapture2##6B#) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\FlyCapture2GUId_v120.exp VideoGrabber_V3
Error 13 error LNK2019: unresolved external symbol _AVIFileCreateStreamW#12 referenced in function "public: bool __thiscall PGRAviFile::open(char const *,int,int,int,double)" (?open#PGRAviFile##QAE_NPBDHHHN#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 9 error LNK2019: unresolved external symbol _AVIFileExit#0 referenced in function "public: bool __thiscall PGRAviFile::close(void)" (?close#PGRAviFile##QAE_NXZ) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 12 error LNK2019: unresolved external symbol _AVIFileGetStream#16 referenced in function "public: bool __thiscall PGRAviFile::open(char *)" (?open#PGRAviFile##QAE_NPAD#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 8 error LNK2019: unresolved external symbol _AVIFileInit#0 referenced in function "public: bool __thiscall PGRAviFile::open(char *)" (?open#PGRAviFile##QAE_NPAD#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 11 error LNK2019: unresolved external symbol _AVIFileOpenW#16 referenced in function "public: bool __thiscall PGRAviFile::open(char *)" (?open#PGRAviFile##QAE_NPAD#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 10 error LNK2019: unresolved external symbol _AVIFileRelease#4 referenced in function "public: bool __thiscall PGRAviFile::close(void)" (?close#PGRAviFile##QAE_NXZ) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 20 error LNK2019: unresolved external symbol _AVIMakeCompressedStream#16 referenced in function "public: bool __thiscall PGRAviFile::open(char const *,int,int,int,double)" (?open#PGRAviFile##QAE_NPBDHHHN#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 15 error LNK2019: unresolved external symbol _AVIStreamInfoW#12 referenced in function "public: bool __thiscall PGRAviFile::open(char *)" (?open#PGRAviFile##QAE_NPAD#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 18 error LNK2019: unresolved external symbol _AVIStreamRead#28 referenced in function "public: bool __thiscall PGRAviFile::readNextFrame(unsigned char *,bool)" (?readNextFrame#PGRAviFile##QAE_NPAE_N#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 16 error LNK2019: unresolved external symbol _AVIStreamReadFormat#16 referenced in function "public: bool __thiscall PGRAviFile::open(char *)" (?open#PGRAviFile##QAE_NPAD#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 14 error LNK2019: unresolved external symbol _AVIStreamRelease#4 referenced in function "public: bool __thiscall PGRAviFile::close(void)" (?close#PGRAviFile##QAE_NXZ) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 17 error LNK2019: unresolved external symbol _AVIStreamSetFormat#16 referenced in function "public: bool __thiscall PGRAviFile::open(char const *,int,int,int,double)" (?open#PGRAviFile##QAE_NPBDHHHN#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 19 error LNK2019: unresolved external symbol _AVIStreamWrite#32 referenced in function "public: bool __thiscall PGRAviFile::appendBMP(char const *)" (?appendBMP#PGRAviFile##QAE_NPBD#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 6 error LNK2019: unresolved external symbol _ICClose#4 referenced in function "public: int __thiscall PGRAviFile::enumerateCompressors(int,int,int,struct ICINFO *,int)" (?enumerateCompressors#PGRAviFile##QAEHHHHPAUICINFO##H#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 4 error LNK2019: unresolved external symbol _ICGetInfo#12 referenced in function "public: int __thiscall PGRAviFile::enumerateCompressors(int,int,int,struct ICINFO *,int)" (?enumerateCompressors#PGRAviFile##QAEHHHHPAUICINFO##H#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 3 error LNK2019: unresolved external symbol _ICInfo#12 referenced in function "public: int __thiscall PGRAviFile::enumerateCompressors(int,int,int,struct ICINFO *,int)" (?enumerateCompressors#PGRAviFile##QAEHHHHPAUICINFO##H#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 5 error LNK2019: unresolved external symbol _ICOpen#12 referenced in function "public: int __thiscall PGRAviFile::enumerateCompressors(int,int,int,struct ICINFO *,int)" (?enumerateCompressors#PGRAviFile##QAEHHHHPAUICINFO##H#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 7 error LNK2019: unresolved external symbol _ICSendMessage#16 referenced in function "public: int __thiscall PGRAviFile::enumerateCompressors(int,int,int,struct ICINFO *,int)" (?enumerateCompressors#PGRAviFile##QAEHHHHPAUICINFO##H#Z) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
Error 2 error LNK2019: unresolved external symbol _VideoForWindowsVersion#0 referenced in function "private: bool __thiscall PGRAviFile::checkVFWVersion(void)" (?checkVFWVersion#PGRAviFile##AAE_NXZ) C:\Users\jtower\Documents\Visual Studio 2013\Projects\VideoGrabber_V3\VideoGrabber_V3\PGRAviFile.obj VideoGrabber_V3
I did a little digging around and found that WindowsSDK was not installed on my system. Installed it and linked Vfw32.lib to my project. All LNK2019 errors got resolved.

Boost - Unresolved external symbols when compiling linking with /MT instead of /MD

I've changed the 'Runtime Library' setting of my project in the release configuration to 'Multi-threaded (/MT)' (it was 'Multi-threaded DLL (/MD)' before) to get rid of the dependencies to the msvc*-libraries.
I've build boost using bjam with the options '--prefix=boost_build variant=release link=static runtime-link=static threading=multi runtime-debugging=off', which seems to generate the correct libraries. ('libboost_system-vc120-mt-s-1_55.lib')
However, trying to link with them results in these linker errors:
1>Tags.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error#std##YAXPBD#Z)
1>libboost_system-vc120-mt-s-1_55.lib(error_code.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error#std##YAXPBD#Z)
1>libboost_thread-vc120-mt-s-1_55.lib(thread.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error#std##YAXPBD#Z)
1>Tags.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc#std##YAXXZ)
1>libboost_system-vc120-mt-s-1_55.lib(error_code.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc#std##YAXXZ)
1>libboost_thread-vc120-mt-s-1_55.lib(thread.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc#std##YAXXZ)
1>3ds.obj : error LNK2001: unresolved external symbol "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit#std##QAE#H#Z)
1>3ds.obj : error LNK2001: unresolved external symbol "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit#std##QAE#XZ)
1>3ds.obj : error LNK2001: unresolved external symbol "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?_Locinfo_ctor#_Locinfo#std##SAXPAV12#PBD#Z)
1>3ds.obj : error LNK2001: unresolved external symbol "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor#_Locinfo#std##SAXPAV12##Z)
1>3ds.obj : error LNK2001: unresolved external symbol __Getctype
1>3ds.obj : error LNK2001: unresolved external symbol __Getcvt
1>3ds.obj : error LNK2001: unresolved external symbol "private: static int std::locale::id::_Id_cnt" (?_Id_cnt#id#locale#std##0HA)
1>3ds.obj : error LNK2001: unresolved external symbol "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init#locale#std##CAPAV_Locimp#12#_N#Z)
1>3ds.obj : error LNK2001: unresolved external symbol "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale#locale#std##CAPAV_Locimp#12#XZ)
1>3ds.obj : error LNK2001: unresolved external symbol __Tolower
1>3ds.obj : error LNK2001: unresolved external symbol __Toupper
1>3ds.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map#std##YAPBDH#Z)
1>libboost_system-vc120-mt-s-1_55.lib(error_code.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map#std##YAPBDH#Z)
1>libboost_thread-vc120-mt-s-1_55.lib(thread.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map#std##YAPBDH#Z)
1>3ds.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
1>libboost_system-vc120-mt-s-1_55.lib(error_code.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
1>libboost_thread-vc120-mt-s-1_55.lib(thread.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
1>3ds.obj : error LNK2001: unresolved external symbol "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor#ios_base#std##CAXPAV12##Z)
1>3ds.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range#std##YAXPBD#Z)
1>libboost_system-vc120-mt-s-1_55.lib(error_code.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range#std##YAXPBD#Z)
1>libboost_thread-vc120-mt-s-1_55.lib(thread.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range#std##YAXPBD#Z)
1>3ds.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > std::cout" (?cout#std##3V?$basic_ostream#DU?$char_traits#D#std###1#A)
1>3ds.obj : error LNK2001: unresolved external symbol "__int64 const std::_BADOFF" (?_BADOFF#std##3_JB)
1>3ds.obj : error LNK2001: unresolved external symbol "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd#ios_base#std##SAXPAV12##Z)
1>3ds.obj : error LNK2001: unresolved external symbol "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception#std##YA_NXZ)
1>3ds.obj : error LNK2001: unresolved external symbol "public: static class std::locale::id std::ctype<char>::id" (?id#?$ctype#D#std##2V0locale#2#A)
1>3ds.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Facet_Register(class std::_Facet_base *)" (?_Facet_Register#std##YAXPAV_Facet_base#1##Z)
1>C:\Users\****\Desktop\shared\Visual Studio Projects\weave\Release\shared.dll : fatal error LNK1120: 23 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I've seen various posts here with similar issues, but it always turned out it was due to different compiler settings.
The settings are the same in my case, so what's going on?

Unable to build LSP sample

I downloaded Microsoft platform SDK. I tried to build the sample project LSP under
C:\Program Files\Microsoft Platform
SDK\Samples\NetDS\WinSock\LSP
I got the following linking errors:
asyncselect.obj : error LNK2001: unresolved external symbol "struct HINSTANCE__ * gDllInstance" (?gDllInstance##3PAUHINSTANCE__##A)
asyncselect.obj : error LNK2001: unresolved external symbol "void * gAddContextEvent" (?gAddContextEvent##3PAXA)
sockinfo.obj : error LNK2001: unresolved external symbol "void * gAddContextEvent" (?gAddContextEvent##3PAXA)
extension.obj : error LNK2019: unresolved external symbol __imp__WSASetLastError#4 referenced in function "int __stdcall ExtTransmitFile(unsigned int,void *,unsigned long,unsigned long,struct _OVERLAPPED *,struct _TRANSMIT_FILE_BUFFERS *,unsigned long)" (?ExtTransmitFile##YGHIPAXKKPAU_OVERLAPPED##PAU_TRANSMIT_FILE_BUFFERS##K#Z)
overlap.obj : error LNK2001: unresolved external symbol __imp__WSASetLastError#4
extension.obj : error LNK2019: unresolved external symbol __imp__WSAGetLastError#0 referenced in function "int __stdcall ExtTransmitFile(unsigned int,void *,unsigned long,unsigned long,struct _OVERLAPPED *,struct _TRANSMIT_FILE_BUFFERS *,unsigned long)" (?ExtTransmitFile##YGHIPAXKKPAU_OVERLAPPED##PAU_TRANSMIT_FILE_BUFFERS##K#Z)
overlap.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
instlsp.obj : error LNK2019: unresolved external symbol __imp__WSACleanup#0 referenced in function _main
instlsp.obj : error LNK2019: unresolved external symbol __imp__WSAStartup#8 referenced in function _main
lspadd.obj : error LNK2019: unresolved external symbol _WSCInstallProvider#20 referenced in function "int __cdecl InstallProvider(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,struct _WSAPROTOCOL_INFOW *,int)" (?InstallProvider##YAHW4WINSOCK_CATALOG##PAU_GUID##PA_WPAU_WSAPROTOCOL_INFOW##H#Z)
lspadd.obj : error LNK2019: unresolved external symbol _WSCGetProviderPath#16 referenced in function "int __cdecl InstallIfsLspProtocolChains(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,wchar_t *,unsigned long *,unsigned long)" (?InstallIfsLspProtocolChains##YAHW4WINSOCK_CATALOG##PAU_GUID##PA_W2PAKK#Z)
lspmap.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath#16
prnpinfo.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath#16
provider.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath#16
lspadd.obj : error LNK2019: unresolved external symbol __imp__UuidCreate#4 referenced in function "int __cdecl InstallIfsLspProtocolChains(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,wchar_t *,unsigned long *,unsigned long)" (?InstallIfsLspProtocolChains##YAHW4WINSOCK_CATALOG##PAU_GUID##PA_W2PAKK#Z)
lspadd.obj : error LNK2019: unresolved external symbol _WSCWriteProviderOrder#8 referenced in function "int __cdecl WriteProviderOrder(enum WINSOCK_CATALOG,unsigned long *,unsigned long,int *)" (?WriteProviderOrder##YAHW4WINSOCK_CATALOG##PAKKPAH#Z)
lspdel.obj : error LNK2019: unresolved external symbol _WSCDeinstallProvider#8 referenced in function "int __cdecl DeinstallProvider(enum WINSOCK_CATALOG,struct _GUID *)" (?DeinstallProvider##YAHW4WINSOCK_CATALOG##PAU_GUID###Z)
overlap.obj : error LNK2001: unresolved external symbol "struct _RTL_CRITICAL_SECTION gOverlappedCS" (?gOverlappedCS##3U_RTL_CRITICAL_SECTION##A)
overlap.obj : error LNK2019: unresolved external symbol "void __cdecl FreeWSABuf(struct _WSABUF *)" (?FreeWSABuf##YAXPAU_WSABUF###Z) referenced in function "void __cdecl FreeOverlappedStructure(struct _WSAOVERLAPPEDPLUS *)" (?FreeOverlappedStructure##YAXPAU_WSAOVERLAPPEDPLUS###Z)
overlap.obj : error LNK2019: unresolved external symbol _WPUCompleteOverlappedRequest#20 referenced in function "void __stdcall IntermediateCompletionRoutine(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long)" (?IntermediateCompletionRoutine##YGXKKPAU_OVERLAPPED##K#Z)
overlap.obj : error LNK2019: unresolved external symbol "struct _WSABUF * __cdecl CopyWSABuf(struct _WSABUF *,unsigned long,int *)" (?CopyWSABuf##YAPAU_WSABUF##PAU1#KPAH#Z) referenced in function "struct _WSAOVERLAPPEDPLUS * __cdecl PrepareOverlappedOperation(struct _SOCK_INFO *,enum LspOperation,struct _WSABUF *,unsigned long,struct _OVERLAPPED *,void (__stdcall*)(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long),struct _WSATHREADID *,int *)" (?PrepareOverlappedOperation##YAPAU_WSAOVERLAPPEDPLUS##PAU_SOCK_INFO##W4LspOperation##PAU_WSABUF##KPAU_OVERLAPPED##P6GXKK3K#ZPAU_WSATHREADID##PAH#Z)
overlap.obj : error LNK2019: unresolved external symbol "void __cdecl CopyOffset(struct _OVERLAPPED *,struct _OVERLAPPED *)" (?CopyOffset##YAXPAU_OVERLAPPED##0#Z) referenced in function "struct _WSAOVERLAPPEDPLUS * __cdecl PrepareOverlappedOperation(struct _SOCK_INFO *,enum LspOperation,struct _WSABUF *,unsigned long,struct _OVERLAPPED *,void (__stdcall*)(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long),struct _WSATHREADID *,int *)" (?PrepareOverlappedOperation##YAPAU_WSAOVERLAPPEDPLUS##PAU_SOCK_INFO##W4LspOperation##PAU_WSABUF##KPAU_OVERLAPPED##P6GXKK3K#ZPAU_WSATHREADID##PAH#Z)
provider.obj : error LNK2019: unresolved external symbol _WSCEnumProtocols#16 referenced in function "struct _WSAPROTOCOL_INFOW * __cdecl EnumerateProviders(enum WINSOCK_CATALOG,int *)" (?EnumerateProviders##YAPAU_WSAPROTOCOL_INFOW##W4WINSOCK_CATALOG##PAH#Z)
sockinfo.obj : error LNK2001: unresolved external symbol "struct _PROVIDER * gBaseInfo" (?gBaseInfo##3PAU_PROVIDER##A)
spi.obj : error LNK2019: unresolved external symbol "struct _SOCKET_CONTEXT * __cdecl FindSocketContext(unsigned int,int)" (?FindSocketContext##YAPAU_SOCKET_CONTEXT##IH#Z) referenced in function "int __stdcall WSPCloseSocket(unsigned int,int *)" (?WSPCloseSocket##YGHIPAH#Z)
spi.obj : error LNK2019: unresolved external symbol "void __cdecl FreeSocketContext(struct _PROVIDER *,struct _SOCKET_CONTEXT *)" (?FreeSocketContext##YAXPAU_PROVIDER##PAU_SOCKET_CONTEXT###Z) referenced in function "unsigned int __stdcall WSPSocket(int,int,int,struct _WSAPROTOCOL_INFOW *,unsigned int,unsigned long,int *)" (?WSPSocket##YGIHHHPAU_WSAPROTOCOL_INFOW##IKPAH#Z)
spi.obj : error LNK2019: unresolved external symbol "struct _SOCKET_CONTEXT * __cdecl CreateSocketContext(struct _PROVIDER *,unsigned int,int *)" (?CreateSocketContext##YAPAU_SOCKET_CONTEXT##PAU_PROVIDER##IPAH#Z) referenced in function "unsigned int __stdcall WSPSocket(int,int,int,struct _WSAPROTOCOL_INFOW *,unsigned int,unsigned long,int *)" (?WSPSocket##YGIHHHPAU_WSAPROTOCOL_INFOW##IKPAH#Z)
spi.obj : error LNK2019: unresolved external symbol __imp__inet_addr#4 referenced in function "void __cdecl FindDestinationAddress(struct _SOCKET_CONTEXT *,struct sockaddr const *,int,struct sockaddr * *,int *)" (?FindDestinationAddress##YAXPAU_SOCKET_CONTEXT##PBUsockaddr##HPAPAU2#PAH#Z)
spi.obj : error LNK2019: unresolved external symbol "void __cdecl FreeSocketContextList(struct _PROVIDER *)" (?FreeSocketContextList##YAXPAU_PROVIDER###Z) referenced in function "void __cdecl FreeLspProviders(struct _PROVIDER *,int,int *)" (?FreeLspProviders##YAXPAU_PROVIDER##HPAH#Z)
Debug\My_LSP.exe : fatal error LNK1120: 23 unresolved externals
I am using Visual C++ 2008 Express on Windows XP. I included the folders include and lib to the created project.
Any idea or suggestion?
It looks like the include/lib paths are incorrect.
You need to have the PSDK first in the include path or you can run the PSDK environment and then run your IDE with the /useenv flag.
Also you didn't link ws2_32.lib

Resources