curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

curl as static lib gives me linker errors

From: Julien Matthey via curl-library <curl-library_at_lists.haxx.se>
Date: Sat, 9 Apr 2022 20:37:30 +0200

Hello,

I am building on Windows 10 msvc.

- I downloaded curl-7.82.0

- Ran CMAKE and *unchecked *the BUILD_SHARED_LIBS option; generated the
visual studio project and built it; so far so good.

- My test app is:


#include <include/curl.h>//<.just a pragma to include the .lib
[debug/release]
#include <curl/curl.h>
#include <iostream>

int main(int argc, char** argv) {
     std::cout << "version: " << curl_version() << std::endl;
     return 0;
}


I get linker error:

*1>curl.obj : error LNK2019: symbole externe non résolu
__imp_curl_version référencé dans la fonction main*


What is strange is that the CURL_STATICLIB macro is NOT set in my build
(curl.h#109); and CURL_EXTERN expands as __declspec(dllimport);
obviously it shouldn't.

What am I doing wrong?

Thanks,

-Julien


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-04-09