jgaa / restc-cpp

Modern C++ REST Client library
MIT License
600 stars 93 forks source link

C3861 - 'SSL_set_tlsext_host_name': identifieer not found building rest-cpp for windows 10 #121

Open frzvtr opened 2 years ago

frzvtr commented 2 years ago

I'm trying to build for windows 10 but it is failing with this error when I run the build script, I find it strange that Visual Studio 2019 can find a reference for this symbol inside a header referenced before but it still fails building.

I've only changed the .bat file in order to build in my machie:

rem   Example file on how to build under Windows
rem   using DCMAKE_PREFIX_PATH to specify where
rem   cmake's find* should look for dependencies. 

rmdir /S /Q build
mkdir build
cd build
rem -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
cmake -DCMAKE_PREFIX_PATH=C:\libraries_CPP\include;C:\libraries_CPP\include\openssl;C:\libraries_CPP\include\boost;C:\libraries_CPP\lib\x64;C:\libraries_CPP\bin\x64; -G "Visual Studio 16 2019" ..
cmake --build . --config Debug
cmake --build . --config Release
cd ..
@pause

This is the error message:

RestClientImpl.cpp                                                                                                                  
RequestImpl.cpp                                                                                                             
ReplyImpl.cpp                                                                                                           
ConnectionPoolImpl.cpp                                                                                                
C:\Users\fabiotk\Downloads\restc-cpp-0.10.0\src\TlsSocketImpl.h(74,13): error C3861: 
'SSL_set_tlsext_host_name':  identificador não encontrado [C:\Users\fabiotk\Downloads\restc-cpp-0.10.0\build\restc-cpp.vcxproj]

However the symbol is defined in C:\libraries_CPP\include\openssl\tls1.h

#define SSL_set_tlsext_host_name(s,name) \
SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name)

My question is why the compiler can't find the symbol?

jgaa commented 2 years ago

Are you linking with the correct openssl libraries?