How to statically link libcurl with dev c++?

2019-07-02 06:13发布

问题:

Recently I am trying to link libcurl with dev c++ statically.I linked all the .a files except libcurldll.a file which came from libcurl and I defined CURL_STATICLIB . But I received some linker errors. Then I searched google for the solution of this linker error, there I found that "libwsock32.a" should be linked. And finally I linked libwsock32.a. But I am still receiving different linker errors... Errors are like....

[Linker error] undefined reference to `_imp__ldap_set_optionA' 
[Linker error] undefined reference to `_imp__ldap_initA' 
[Linker error] undefined reference to `_imp__ldap_set_optionA' 
[Linker error] undefined reference to `_imp__ldap_simple_bind_sA' 
[Linker error] undefined reference to `_imp__ldap_search_sA' 
[Linker error] undefined reference to `_imp__ldap_first_entry' 
[Linker error] undefined reference to `_imp__ldap_get_dnA' 
[Linker error] undefined reference to `_imp__ldap_first_attributeA' 
[Linker error] undefined reference to `_imp__ldap_get_values_lenA' 
[Linker error] undefined reference to `_imp__ldap_value_free_len' 
[Linker error] undefined reference to `_imp__ldap_memfreeA' 
[Linker error] undefined reference to `_imp__ldap_next_attributeA' 
[Linker error] undefined reference to `_imp__ldap_memfreeA' 
[Linker error] undefined reference to `_imp__ldap_next_entry' 
[Linker error] undefined reference to `_imp__ldap_err2stringA' 
[Linker error] undefined reference to `_imp__ldap_unbind_s' 
[Linker error] undefined reference to `_imp__ldap_msgfree' 

And so on.........

I also searched for this linker errors in google but nothing found. Plzzzz give me a solution why I am receiving this linker errors????

回答1:

For Windows and Mingw gcc or g++, add libwldap32.a to linker, literally it is a -lwldap32 linker option.



回答2:

Looks like you need to link with ldap. You should also consider not using Dev-C++, and use an actively developed, high quality IDE like Eclipse CDT