Compile Curl Visual Studio - unresolved external symbol

1.1k views Asked by At

I need to use a static library of libcurl and I found this github rep that generate the libraries.

Now, I'm trying to compile a simple piece of code that use curl using the static library, libcurl_a.lib, but without success.

At first, I miss the -DCURL_STATICLIB flag and I got some undefined reference errors:

undefined reference to `curl_easy_init'
undefined reference to `curl_easy_setopt'
undefined reference to `curl_easy_setopt'
undefined reference to `curl_easy_perform'
undefined reference to `curl_easy_strerror'
undefined reference to `curl_easy_cleanup'

The flag solve it, but now i got these ones:

unresolved external symbol __imp__strtoll
unresolved external symbol __imp__strtoll
unresolved external symbol __imp__strtoll
unresolved external symbol __imp__strtoll referenced in function _Curl_ftp_parselist
unresolved external symbol __imp__strtoll
unresolved external symbol __imp__strtoll
unresolved external symbol __imp__strtoll
unresolved external symbol __imp__strtoll
unresolved external symbol __imp__GetTickCount64@0 referenced in function _curlx_tvnow
unresolved external symbol __imp__InitializeCriticalSectionEx@12 referenced in function _init_thread_sync_data
unresolved external symbol __ltod3 referenced in function _getinfo_double
unresolved external symbol __ltod3
unresolved external symbol __dtol3 referenced in function _Curl_pgrsUpdate
unresolved external symbol ___report_rangecheckfailure referenced in function _base64_encode

I'm stuck here and I don't know how to solve this unresolved external symbols.

Anybody can help me? Thanks

2

There are 2 answers

0
hmiguel On BEST ANSWER

Solution:

There is a problem with github repository .bat file, only seems to work with most recent VS versions. I used an older one version of build.bat and worked fine.

For reference: Compiled with VS 2005.

1
Vivian De Smedt On

It could be that you are linking against the wrong version of kernel32.lib. Do you make x64 build? If so, you need to correct your library path.