- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有这个简单的 C++ 代码。
#include <iostream>
#include <windows.h>
#include <Lmcons.h>
#define CURL_STATICLIB
#include <iostream>
#include <fstream>
#include <curl.h>
#include <stdio.h>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "curl\\libeay32.lib")
#pragma comment(lib, "curl\\openldap.lib")
#pragma comment(lib, "curl\\ssleay32.lib")
#if defined _DEBUG
#pragma comment(lib, "curl\\lib\\Debug\\curllib_static.lib")
#else
#pragma comment(lib, "curl\\lib\\Release\\curllib_static.lib")
#endif
using namespace std;
int main()
{
TCHAR name [ UNLEN + 1 ];
DWORD size = UNLEN + 1;
if (GetUserName( (TCHAR*)name, &size ))
wcout << "Hello, " << name << "!\n";
else
wcout << "Hello, unnamed person!\n";
CURL *curl;
CURLcode res;
curl_version();
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_URL, "http://requestb.in/19l9fjg1");
/* Now specify the POST data */
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
curl_global_cleanup();
system("PAUSE");
return 0;
}
我的目录树。
X
| app.cpp
|
+---curl
| | CHANGES
| | curl.exe
| | curllib.dll
| | libcurl_imp.lib
| | libeay32.dll
| | libeay32.lib
| | openldap.dll
| | openldap.lib
| | README
| | ssleay32.dll
| | ssleay32.lib
| |
| +---docs
| | | BINDINGS
| | | [...]
| | | VERSIONS
| | |
| | +---examples
| | | 10-at-a-time.c
| | | [...]
| | | threaded-ssl.c
| | |
| | \---libcurl
| | ABI
| | [...]
| | Makefile.in
| |
| +---include
| | | Makefile.am
| | | [...]
| | | README
| | |
| | \---curl
| | curl.h
| | [...]
| | types.h
| |
| +---lib
| | +---Debug
| | | curllib.dll
| | | curllib.lib
| | | curllib_static.lib
| | |
| | \---Release
| | curllib.dll
| | curllib.lib
| | curllib_static.lib
| |
| \---src
| +---DLL-Debug
| | curl.exe
| | curllib.dll
| | openldap.dll
| |
| +---DLL-Release
| | curl.exe
| | curllib.dll
| | openldap.dll
| |
| +---LIB-Debug
| | curl.exe
| |
| \---LIB-Release
| curl.exe
|
+---Debug
| app.obj
| [...]
| vc110.pdb
|
\---Release
app.obj
[...]
vc110.pdb
这就是我的设置。
Linker -> General -> Additional library directories
X\curl\lib\Release;X\curl;%(AdditionalLibraryDirectories)
Linker -> Input -> Additional dependences
$(ProjectDir)curl\lib\Debug\curllib_static.lib;%(AdditionalDependencies)
VC++-Directories -> Include directories
$(ProjectDir)curl\include\curl;$(IncludePath)
VC++-Directories -> Library directories
$(ProjectDir)curl\lib\Release;$(LibraryPath)
**$(ProjectDir) 是 X**
错误。
Error 2 error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 3 error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 4 error LNK2005: _free already defined in LIBCMT.lib(free.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 5 error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 6 error LNK2005: _strrchr already defined in LIBCMT.lib(strrchr.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 7 error LNK2005: _strchr already defined in LIBCMT.lib(strchr.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 8 error LNK2005: _fwrite already defined in LIBCMT.lib(fwrite.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 9 error LNK2005: ___iob_func already defined in LIBCMT.lib(_file.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 10 error LNK2005: _strtoul already defined in LIBCMT.lib(strtol.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 11 error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 12 error LNK2005: _tolower already defined in LIBCMT.lib(tolower.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 13 error LNK2005: _atoi already defined in LIBCMT.lib(atox.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 14 error LNK2005: _isxdigit already defined in LIBCMT.lib(_ctype.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 15 error LNK2005: _isdigit already defined in LIBCMT.lib(_ctype.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 16 error LNK2005: _isspace already defined in LIBCMT.lib(_ctype.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 17 error LNK2005: __strtoi64 already defined in LIBCMT.lib(strtoq.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 18 error LNK2005: _memchr already defined in LIBCMT.lib(memchr.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 19 error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 20 error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 21 error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 22 error LNK2005: _fflush already defined in LIBCMT.lib(fflush.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 23 error LNK2005: __errno already defined in LIBCMT.lib(dosmap.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 24 error LNK2005: __lseeki64 already defined in LIBCMT.lib(lseeki64.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 25 error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 26 error LNK2005: _isalnum already defined in LIBCMT.lib(_ctype.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 27 error LNK2005: _isalpha already defined in LIBCMT.lib(_ctype.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 28 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj). X\MSVCRT.lib(ti_inst.obj) X
Error 29 error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj). X\MSVCRT.lib(ti_inst.obj) X
Error 30 error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 31 error LNK2005: __close already defined in LIBCMT.lib(close.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 32 error LNK2005: __fileno already defined in LIBCMT.lib(fileno.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 33 error LNK2005: __read already defined in LIBCMT.lib(read.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 34 error LNK2005: __strnicmp already defined in LIBCMT.lib(strnicmp.obj). X\MSVCRT.lib(MSVCR110.dll) X
Error 35 error LNK1169: One or more multiply defined symbols found in. X\..\Release\X.exe X
如果我将 curllib_static.lib
替换为上面的 curllib.lib
,我会收到 libcurl.dll 丢失的错误消息。
正因为如此,而且因为我不想在我的目录中有额外的 libcurl.dll,所以我使用的是静态 libcurl。
如何解决?
我将此 libcurl 与 Microsoft Visual Studio 2012 结合使用。 http://curl.haxx.se/download/libcurl-7.19.3-win32-ssl-msvc.zip
最佳答案
像这样的问题在 Visual C++ 中很常见,要准确描述如何修复这些问题并不容易。您需要格外小心并真正了解您包含了哪些库,这里没有足够的信息来解决这个问题。
一个常见的原因是使用了错误的运行时库。在 VS 中,这将是/MT 和/MD 开关之间的区别,但您似乎正在使用 makefile,因此可能不适用。 LIBCMT 是多线程库,但看起来您可能还包含另一个库。
我不建议使用#pragmas 来包含链接库。将它们放在 makefile 中,这样您就可以在一个地方看到所有内容。
通常,在启用日志记录的情况下运行链接器有助于准确查看正在调用的库。
您的目录树和设置几乎没有帮助,但包含 makefile 的最小完整项目可能允许这里的某人诊断问题。
关于C++ 链接器不能将外部符号与静态 libcurl 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25644407/
我有一个网站,并且我使用 javascript sdk 添加了“点赞”按钮。 这是代码 (function(d, s, id) { var js, fjs = d.g
我知道 HTML 是逐行读取的。当您链接多个 css 文件(如规范化文件和样式表文件)时,由于 CSS 重要性特异性和源顺序,样式表文件应链接在规范化文件之后。看起来这不会影响链接的 JavaScri
我正在使用官方 Bootstrap site 提供的 CDN 链接在我的网络应用程序中使用面板进行测试 在彻底检查我的代码后,面板没有显示。 但是我在 SO 上看到了类似的帖子并且 CDN 链接不同
这里是编码初学者。我正在尝试为我的移动设备网站设置断点,以便我的网站适合小屏幕。我只是想检查如果我缩小视口(viewport)的宽度,背景颜色是否会改变,但没有发生任何变化。也许我只是对一个简单的错误
举一个我想要的例子,想象一下这个字符串: $text = 'lorem ipsum About us lorem ipsum'; 如果此字符串包含一个 href 以 / 开头的 anchor 链接,则
如何链接到 LaTeX 文档的另一部分或子部分?这种链接的常规范式是什么,像[链接名称]那样写,或者像网页超链接那样写? 最佳答案 链接到另一个部分需要您的部分进行一些额外的标记。要使用的命令是: \
我有一个订单表,其中包含订单号、客户 ID 和代理 ID。然后有一个带有 id 的客户表和一个带有 id 的代理表。 我需要获取所有具有来自代理 ID 'a03' 和代理 ID 'a05' 的订单的客
假设我有: dic = {"z":"zv", "a":"av"} ## Why doesn't the following return a sorted list of keys? keys = d
我在尝试链接到外部库时得到了一些奇怪的结果。如果我从命令行运行以下命令: gcc fftwTest.c -I../extlib/fftw-3.3.5-dll32 -L../extlib/fftw-3.
我认为我没有正确理解 jQuery 链接。我正在遍历一个数组并尝试将 div 元素添加到我的包装器 CSS 类中,每个 div 元素都有一个“click”类和自定义 css top 和 left 属性
HTML 使用超级链接与网络上的另一个文档相连。几乎可以在所有的网页中找到链接。点击链接可以从一张页面跳转到另一张页面。 HTML 超链接(链接) HTML使用标签 a 来设置超文本链接。 超链
这个问题在这里已经有了答案: How do I link to part of a page? (hash?) (7 个答案) Scroll Automatically to the Bottom
我想创建一个 Docker Swarm 集群,运行一个 Elasticsearch 实例、一个 MongoDB 实例和一个 grails 应用程序,每个都在单独的机器上。我正在使用 Docker Ma
我正在尝试将 CakePHP HTML Linker 用于以下代码 Add Cuisine 由于 span 标签需要在 a 标签内。我无法根据需要获得输出。关于如何完成它的任何建议? 最佳答案 禁用链
大家好, 我最近开发了一个应用程序,很快就会提交到 App Store。我想免费提交这个应用程序,并想知道我是否可以实现一个带有 PayPal 捐赠标志的按钮,上面基本上写着“捐赠用于开发”或与此相关
我想尝试在 dlang 中使用 libuv。我下载了这样的 dlang 绑定(bind): git clone git@github.com:tamediadigital/libuv.git 现在我接
我有一个节点(节点 a),各种其他节点(节点 b/c/d/e)与之引用。 我可以创建一个带有参数的 View 作为我正在查看的节点(节点 a),并获取引用该节点的节点列表。 基本上在节点 a 查看节点
我正在尝试建立一个常见问题页面,上面有目录,下面有答案。我想点击目录中的一个问题,并在同一页面上链接到相应的答案。我如何在 CakePHP 中使用 $this->Html->link() 执行此操作方
在 WooCommerce 3.0+ 中,我使用 js 创建了一些选项卡,每个选项卡中包含来自不同类别的产品。我已经设法修改了简单产品的添加到购物车链接,其中点击了 addtocart 按钮它进入下一
Delphi 2007/2009 奇怪的问题在这里: 根据设计时定义的组件属性,是否可以在链接中包含文件或保留文件? 示例:如果我将 SomeProperty 保留为真,则在编译时,单元 SomeUn
我是一名优秀的程序员,十分优秀!