1

I was successfully built a cpprestsdk latest version 2.10.18 which I saw the cpprest141_2_10d.lib was on \Binaries\Debug folder and cpprest141_2_10.lib was on \Binaries\Release as well , but it has a problem when I tried to use it it says

dgsbnewapitest.obj : error LNK2001: unresolved external symbol "public: static class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const web::http::methods::POST" (?POST@methods@http@web@@2v?$basic_string@_WU?$char_traits@_W@std@@v?$allocator@_W@2@@std@@b)
fatal error LNK1120: 1 unresolved externals

I have no idea how to deal with issue, it just looks like didn't link a external library even I tried to do something in my project like

C++ -> Preprocessor definitions, add _NO_ASYNCRTIMP even "_NO_PPLXIMP"

Linker -> Input and added cpprest141_2_10d.lib(debug) or cpprest141_2_10.lib(Release)

in the VS editor section I added

#pragma comment(lib, "bcrypt.lib")
#pragma comment(lib, "winhttp.lib")
#pragma comment(lib, "crypt32.lib")

it doesn't work anyway I have uploaded the binary-file which the libraries I have been built down here below

https://github.com/abcdefghi123456jk/cpprestsdk-binary/releases/tag/2.10.18

please take a look at it

any idea? thank you so much

update:

I gonna elaborate how did I build the cpprestsdk

the way which M$ recommended https://github.com/microsoft/cpprestsdk/wiki/How-to-build-for-Windows was totally NOT working, the way of another bloger https://sageai.blogspot.com/2020/12/how-to-build-cpprestsdk-using-vcpkg-in.html just was able to build the debug library only, not release library though, I tried the way below, it works for me

#1 git clone the library source

git clone https://github.com/Microsoft/cpprestsdk.git

#2 install vcpkg

.\vcpkg\bootstrap-vcpkg.bat

.\vcpkg\vcpkg integrate install

#3 download the dependency libraries I was tried to build 32-bits library,that's why I downloaded 32 bit libraries

.\vcpkg\vcpkg install --triplet x86-windows zlib openssl boost-system boost-date-time boost-regex boost-interprocess websocketpp brotli

#4 git the websocketpp,I'm NOT that too familar with CPP & cmake,that's why I have to git the websocketpp source to websocketpp folder, to make sure cmake was able to find websocketpp, what I doing was

 cd Release
 cd libs
 git clone git://github.com/zaphoyd/websocketpp.git 

#5 everything has been ready, we can cmake the project,then I built a folder for the VS project files

 mkdir build.x86v141
 cd build.x86v141
 cmake ../Release -A Win32 -DCMAKE_TOOLCHAIN_FILE=/REPLACE_THIS_WITH_PATH_TO/vcpkg/scripts/buildsystems/vcpkg.cmake

afterward , I did see the VS project files were generated, then I opened it and built them, that's all

Ken
  • 47
  • 6
  • What build commands did you use? How do you try to use it? Can you run the examples in the repo? –  Apr 06 '21 at 23:56
  • 1
    @adembudak well ,just wait a minute, I gonna elaborate them on the post, thank you for the reply, dude – Ken Apr 06 '21 at 23:58
  • 1
    You seem to confuse with vcpkg and manual build. vcpkg is a package manager and do the things for you so you don't need to clone or build the things manually. I recommend to check out its documentation https://vcpkg.readthedocs.io/en/stable/ –  Apr 07 '21 at 00:18
  • I was able to use my code with cpprestsdk 2.8.x version with VS 2013, for some reasons I have to upgrade it to VS 2017, thta's why I have to build it my own – Ken Apr 07 '21 at 00:18
  • @adembudak thanks for showing the else way, I gonna tried the way you metioned – Ken Apr 07 '21 at 00:20
  • @adembudak thanks for the helps, it works, no more unresolved-external-symbol error with .\vcpkg.exe install cpprestsdk[core,compression] – Ken Apr 07 '21 at 00:58
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Ken White Apr 07 '21 at 01:20
  • @KenWhite nope, I totally understand how to resolve this problem, but I didn't know which specified static library I should link with though,anyway, thanks for your time – Ken Apr 07 '21 at 01:38

0 Answers0