error LNK2019: undefined external symbol while trying to use libcurl

Asked

Viewed 556 times

1

Hello, I’m trying to compile a static library of libcurl, but without success.

I download the libcurl source code version 7.55.1 available at https://curl.haxx.se/download.html. After the download complete I extracted the content to the local disk.

I opened Developer Command Prompt for Visual Studio and used cd C:\curl\winbuild. In this folder there is a file of instructions on how to compile for Windows. I ran the following command line at the prompt.

nmake /f Makefile.vc mode=static DEBUG=no MACHINE=x86

When the process ended there were files in the directory C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl. I added the directory C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\include in Diretórios de Inclusão Adicionais and C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\lib in Diretórios de Biblioteca Adicionais.

And in my source code I added at the top the following code:

#include <curl\curl.h>
#pragma comment(lib, "libcurl_a.lib")

When I try to compile the sample code of this address https://curl.haxx.se/libcurl/c/http-post.html i get several errors about undefined symbols.

1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_global_init referenciado na função _WinMain@16
1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_global_cleanup referenciado na função _WinMain@16
1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_easy_strerror referenciado na função _WinMain@16
1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_easy_init referenciado na função _WinMain@16
1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_easy_setopt referenciado na função _WinMain@16
1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_easy_perform referenciado na função _WinMain@16
1>main.obj : error LNK2019: símbolo externo indefinido __imp__curl_easy_cleanup referenciado na função _WinMain@16

I have already tried to use different options for compilation, including compile using the project for Visual Studio that comes along with libcurl source code and is located at C:\curl\projects\Windows\VC14. Also unsuccessful.

I look forward to some tips to solve this problem, thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.