Open dineshdad opened 3 years ago
I had similiar errors - first occurence was:
Link: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:"G:\Fyo_tests\CppServer\temp\RelWithDebInfo\cppserver-example-https_server.exe" /INCREMENTAL /NOLOGO ..\modules\OpenSSL\VS\lib\libssl.lib ..\modules\OpenSSL\VS\lib\libcry pto.lib "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\Crypt32.Lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\MsWSock.Lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\WS2_32.Lib" modules\CppCommon\RelWithDebInfo\cppcommon.lib RelWithDebInfo\cppserv er.lib "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\Crypt32.Lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\MsWSock.Lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\WS2_32.Lib" modules\CppCommon\RelWithDebInfo\cppcommon.lib "C:\Program Files (x86) \Windows Kits\10\Lib\10.0.18362.0\um\x86\DbgHelp.Lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\RpcRT4.Lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\UserEnv.Lib" modules\CppCommon\modules\RelWithDebInfo\fmt.lib modules\RelWithDebInfo\asio.lib ..\modules\OpenSSL\ VS\lib\libssl.lib ..\modules\OpenSSL\VS\lib\libcrypto.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"G:/Fyo_tests/CppServer/temp/RelWithDebInfo/ cppserver-example-https_server.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"G:/Fyo_tests/CppServer/temp/RelWithDebInfo/cppserver-example-https_server.lib" /MACHINE:X64 /machine:x64 "cppserver-example-https_server.dir\RelWithDebInfo\https_server.obj" 19>cppcommon.lib(uuid.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_UuidCreate" in Funktion ""public: static class CppCommon::UUID __cdecl CppCommon::UUID::Random(void)" (?Random@UUID@CppCommon@@SA?AV12@XZ)". [G:\Fyo_tests\CppServer\temp\cppserver-example-tcp_chat_server.vcxproj] 19>cppcommon.lib(uuid.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_UuidCreateSequential" in Funktion ""public: static class CppCommon::UUID __cdecl CppCommon::UUID::Sequential(void)" (?Sequential@UUID@CppCommon@@SA?AV12@XZ)". [G:\Fyo_tests\CppServer\temp\cppserver-example-tcp_chat_
As you will notice, the link.exe is being run from x64 folder, while libs are being used from C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86 => the lib path is wrong!
In build\VisualStudio\01-generate.bat you can see
cmake -DCMAKE_INSTALL_PREFIX=../temp/install -G "Visual Studio 16 2019" -A x64 ..
So C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64
would have been correct on my machine for the lib files.
SOLUTION: before running vs.bat I had to run the following
SET CMAKE_LIBRARY_PATH=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64
(check if this is the correct path on your machine!)
Why isn't that environment variable set in the vs.bat script?
As this has no visual studio project in it. I created a new project and created the example file. I included the directories of the dependency headers. But I am getting linker error 1>Source.obj : error LNK2019: unresolved external symbol "unsigned long cdecl asio::detail::win_tss_ptr_create(void)" (?win_tss_ptr_create@detail@asio@@YAKXZ) referenced in function "public: cdecl asio::detail::win_tss_ptr<class asio::detail::call_stack<class asio::detail::thread_context,class asio::detail::thread_info_base>::context>::win_tss_ptr<class asio::detail::call_stack<class asio::detail::thread_context,class asio::detail::thread_info_base>::context>(void)" (??0?$win_tss_ptr@Vcontext@?$call_stack@Vthread_context@detail@asio@@Vthread_info_base@23@@detail@asio@@@detail@asio@@QEAA@XZ) 1>Source.obj : error LNK2019: unresolved external symbol "class std::error_category const & cdecl asio::system_category(void)" (?system_category@asio@@YAAEBVerror_category@std@@XZ) referenced in function "class std::error_category const & cdecl asio::error::get_system_category(void)" (?get_system_category@error@asio@@YAAEBVerror_category@std@@XZ) 1>Source.obj : error LNK2019: unresolved external symbol "public: cdecl asio::system_context::~system_context(void)" (??1system_context@asio@@QEAA@XZ) referenced in function "public: void * __cdecl asio::system_context::`scalar deleting destructor'(unsigned int)" (??_Gsystem_context@asio@@QEAAPEAXI@Z) 1>Source.obj : error LNK2019: unresolved external symbol "protected: static void cdecl asio::detail::winsock_init_base::startup(struct asio::detail::winsock_init_base::data &,unsigned char,unsigned char)" (?startup@winsock_init_base@detail@asio@@KAXAEAUdata@123@EE@Z) referenced in function "public: cdecl asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" (??0?$winsock_init@$01$0A@@detail@asio@@QEAA@_N@Z) 1>Source.obj : error LNK2019: unresolved external symbol "protected: static void cdecl asio::detail::winsock_init_base::cleanup(struct as