c++静态链接旋度
C++ Link Curl Statically
我在DEV c++环境中使用这段代码。
#include <stdio.h>
#include <curl/curl.h>
#include <iostream>
using namespace std;
int main(void){
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "TestAgent");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
system("pause");
return 0;
}
我已经链接了libcurllll。A和libcurl。一个文件。我可以编译和运行代码,但可执行文件需要msvcr70.dll和libcurl.dll在同一目录下。我如何静态地链接它们?
看看curl-config
工具。它提供了一个选项来获取用于构建静态链接的libcurl的链接器标志和依赖项:
——static-libs
显示了完整的库集和您需要的其他链接器选项将应用程序与libcurl静态地链接起来。(在7.17.1中添加)
为此,您需要在您的环境中从源代码构建libcurl。
相关文章:
- 如果我想链接静态库并删除未使用的符号.txt我应该如何处理 Cmakelist
- 为什么当我在 C 程序中链接静态库时会"undefined symbol"?
- 强制链接静态库与 cmake 不起作用
- CMake 项目链接静态库
- 使用 CMake 在 Mac 上链接静态 GLFW 和 OpenGL
- DLL 链接静态库 - 未使用函数中未解析的链接器符号
- 如何使用 WAF 链接静态库?
- 无法在 Mac OS X 上链接静态资源库
- MAPI 链接静态库 (LNK2019: 未解析的外部符号)
- 为什么G 不链接静态程序
- 节点本机模块 - 链接静态库
- 在链接链接静态(GSOAP)库的共享库时,为什么会得到一个未定义的符号
- 链接静态和动态库时违反 ODR
- 代码中的MinGW::块不链接静态OpenSSL库
- Emscripten 链接静态库错误:wasm 流式编译失败:导入'env.getTempRet0'
- 如何正确链接静态类
- CMake 链接静态库和 glib 错误
- Eclipse CDT:如何在没有项目清理>>项目重建的情况下重新链接静态库
- 错误:链接静态库时出现";"
- gcc 如何链接静态库