Lesson compile a static library libcurl

1 compiled libcurl static library
    to ensure that the next C / C ++ page code generation / runtime ensures consistency with solutions to ensure regular at the output path and destination file name (d)
pre-processor 2 C / C ++ property page property page settings defined
_DEBUG
BUILDING_LIBCURL
DebugBuild
CURL_STATICLIB
HTTP_ONLY
USE_WINDOWS_SSPI
USE_SCHANNEL
USE_WINDOWS_SSPI precompiled and USE_SCHANNEL two process definition is used to define the hTTPS, using https protocol to specify, remember!


2 link error analysis
1) error LNK2019: unresolved external symbol __imp__curl_easy_init, the symbol is referenced in the function _main the
analysis: not defined CURL_STATICLIB compile the results, because CURL_EXTERN CURL * curl_easy_init (void); CURL_EXTERN have previously defined function, and this definition
#if (defined (WIN32) || defined (_WIN32) || defined (__ SYMBIAN32__)) && \
     ! defined (CURL_STATICLIB)
#if defined (BUILDING_LIBCURL)
#define CURL_EXTERN __declspec (dllexport)
#else
#define CURL_EXTERN __declspec ( dllimport)
#endif
#else
is defined here, if not defined CURL_STATICLIB, will lead to CURL_EXTERN be replaced with __declspec (dllexport) or __declspec (dllimport), the two declarations apply only to the dynamic link, can not be applied statically linked

2) error LNK2019: unresolved external symbol __imp__ldap_init, the symbol is referenced in function __ldap_free_urldesc
add additional static library Crypt32.lib, Wldap32.lib property references in the project, otherwise the following error because the use https

Revision:
2019/7/20 understand the significance CURL_STATICLIB precompiled header definitions


Guess you like

Origin blog.51cto.com/fengyuzaitu/2433565