您试图与不兼容的库链接。

重要事项 运行时库现在包含防止混合不同类型的指令。如果试图在同一个程序中使用不同类型的运行时库
或使用调试和非调试版本的运行时库,则将收到此警告。例如,如果编译一个文件以使用一种运行时库,
而编译另一个文件以使用另一种运行时库(例如单线程运行时库对多线程运行时库),并试图链接它们,
则将得到此警告。应将所有源文件编译为使用同一个运行时库。有关更多信息,请参阅使用运行时库(/MD
、/ML、/MT、/LD)编译器选项。可以使用链接器的 /VERBOSE:LIB 开关来确定链接器搜索的库。如果收到
LNK4098,并想创建使用如单线程、非调试运行时库的可执行文件,请使用 /VERBOSE:LIB 选项确定链接
器搜索的库。链接器作为搜索的库输出的应是 LIBC.lib,而非 LIBCMT.lib、MSVCRT.lib、LIBCD.lib、
LIBCMTD.lib 和 MSVCRTD.lib。对每个要忽略的库可以使用 /NODEFAULTLIB,以通知链接器忽略错误的运
行时库。

下表显示根据要使用的运行时库应忽略的库。

若要使用此运行时库 请忽略这些库 
单线程 (libc.lib) libcmt.lib、msvcrt.lib、libcd.lib、libcmtd.lib、msvcrtd.lib 
多线程 (libcmt.lib) libc.lib、msvcrt.lib、libcd.lib、libcmtd.lib、msvcrtd.lib 
使用 DLL 的多线程 (msvcrt.lib) libc.lib、libcmt.lib、libcd.lib、libcmtd.lib、msvcrtd.lib 
调试单线程 (libcd.lib) libc.lib、libcmt.lib、msvcrt.lib、libcmtd.lib、msvcrtd.lib 
调试多线程 (libcmtd.lib) libc.lib、libcmt.lib、msvcrt.lib、libcd.lib、msvcrtd.lib 
使用 DLL 的调试多线程 (msvcrtd.lib) libc.lib、libcmt.lib、msvcrt.lib、libcd.lib、libcmtd.lib

例如,如果收到此警告,并希望创建使用非调试、单线程版本的运行时库的可执行文件,可以将下列选项
与链接器一起使用:

/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib 
/NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib

vc2010使用libcurl静态库 遇到连接失败的解决方案
2010-11-10 15:35

下载libcurl的源码,打开lib文件夹下项目,编译为静态链接库。

在编译的时候出现问题如下:

注:以前在vc2005下用mfc工程并且libcurl用的dll方式没问题,这次vc2008用的sdk并且libcurl用的静态编译,也不知道什么问题引起的

HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_slist_free_all
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_easy_cleanup
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_easy_getinfo
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_easy_setopt
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_slist_append
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_easy_init
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_global_init
1>HttpWebRequest.obj : error LNK2001: 无法解析的外部符号 __imp__curl_easy_perform

上网查了好久找到了这个链接:

http://bobobobo.wordpress.com/2008/11/08/working-with-curl-getting-started-the-easy-way-on-win32/终于解决了问题

具体步骤就是:

1、给工程添加依赖的库:项目->属性->链接器->输入->附加依赖项,把libcurl.lib ws2_32.lib winmm.lib wldap32.lib添加进去

注意,debug配置用libcurld.lib

2、加入预编译选项:项目->属性->c/c++ ->预处理器->预处理器,把  ;BUILDING_LIBCURL;HTTP_ONLY复制进去(注意不要丢了";")

C Run-Time Library Functions for Thread Control
2010-11-10 15:45

All Win32 programs have at least one thread. Any thread can create additional threads. A thread can complete its work quickly and then terminate, or it can stay active for the life of the program.

The LIBCMT and MSVCRT C run-time libraries provide two functions for thread creation and termination: _beginthread and _endthread.

The _beginthread function creates a new thread and returns a thread identifier if the operation is successful. The thread terminates automatically if it completes execution, or it can terminate itself with a call to _endthread.

Warning   If you are going to call C run-time routines from a program built with LIBCMT.LIB, you must start your threads with the _beginthread function. Do not use the Win32 functions ExitThread and CreateThread. Using SuspendThread can lead to a deadlock when more than one thread is blocked waiting for the suspended thread to complete its access to a C run-time data structure.

The _beginthread Function

The _beginthread function creates a new thread. A thread shares the code and data segments of a process with other threads in the process, but has its own unique register values, stack space, and current instruction address. The system gives CPU time to each thread, so that all threads in a process can execute concurrently.

The _beginthread function is similar to the CreateThread function in the Win32 API but has these differences:

  • The _beginthread function lets you pass multiple arguments to the thread.
  • The _beginthread function initializes certain C run-time library variables. This is important only if you use the C run-time library in your threads.
  • CreateThread provides control over security attributes. You can use this function to start a thread in a suspended state.

The _beginthread function returns a handle to the new thread if successful or –1 if there was an error.

The _endthread Function

The _endthread function terminates a thread created by _beginthread. Threads terminate automatically when they finish. The _endthread function is useful for conditional termination from within a thread. A thread dedicated to communications processing, for example, can quit if it is unable to get control of the communications port.

See Also

Multithreading with C and Win32

其他参考资料:

How to link with the correct C Run-Time (CRT) library

How To Use the C Run-Time

默认库“library”与其他库的使用冲突;使用 /NODEFAULTLIB:library的更多相关文章

  1. warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

    最近在编译库文件后,使用它做APP,遇到如下问题: 1>LIBCMT.lib(invarg.obj) : error LNK2005: __pInvalidArgHandler 已经在 LIBC ...

  2. LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

    LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突:请使用 /NODEFAULTLIB:library 转自:http://blog.csdn.net/pgms ...

  3. 解决:warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;找到 MSIL .netmodule 或使用 /GL 编译的模块;正在。。;LINK : warning LNK4075: 忽略“/INCREMENTAL”(由于“/LTCG”规范)

    参考资料: http://blog.csdn.net/laogaoav/article/details/8544880 http://stackoverflow.com/questions/18612 ...

  4. 修改OpenSSL默认编译出的动态库文件名称

    在 Windows 平台上调用动态链接库 dll 文件时,有两种方式:a) 隐式的加载时链接:使用 *.lib (导入库)文件,在 IDE 的链接器相关设置中加入导入库 lib 文件的名称,或在程序中 ...

  5. LNK4098: 默认库“MSVCRT”与其他库的使用冲突

    LNK4098: 默认库"MSVCRT"与其他库的使用冲突 修改的方法:在项目属性中,在连接器-输入选项中,在忽略特定库中添加相应的库,具体添加那些苦请参照下面的表格. 下面的内容 ...

  6. 解决:warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;找到 MSIL .netmodule 或使用 /GL 编译的模块;正在。。;LINK : warning LNK4075: 忽略“/INCREMENTAL”(由于“/LTCG”规范)

    原文链接地址:https://www.cnblogs.com/qrlozte/p/4844411.html 参考资料: http://blog.csdn.net/laogaoav/article/de ...

  7. linux下gcc默认搜索头文件及库文件的路径

    一.头文件gcc 在编译时如何去寻找所需要的头文件:※所以header file的搜寻会从-I开始※然后找gcc的环境变量 C_INCLUDE_PATH,CPLUS_INCLUDE_PATH,OBJC ...

  8. 备份时如何排除掉默认的 information_schema 和 mysql 库?

    备份时如何排除掉默认的 information_schema 和 mysql 库? mysql -e "show databases;" -uroot -ppassword | g ...

  9. 使用Xcode 5创建Cocoa Touch Static Library(静态库)

    转自:http://blog.csdn.net/jymn_chen/article/details/21036035 首先科普一下静态库的相关知识: 程序编译一般需经预处理.编译.汇编和链接几个步骤. ...

随机推荐

  1. Arison [JS]window.location获取url各项参数详解

    https://www.cnblogs.com/Arison/p/5286368.html 对于这样一个URL代码如下 复制代码 http://www.php230.com :80/fisker/po ...

  2. mysql中的tinyint在C#中的类型

    mysql中的tinyint在C#中的类型 在C#中对应的类型是System.SByte,不是byte.

  3. LeetCode OJ:LRU Cache(最近使用缓存)

    Design and implement a data structure for Least Recently Used (LRU) cache. It should support the fol ...

  4. 一月收集几个有用的谷歌Chrome插件

    谷歌Chrome自推出以来已经从一个简单的浏览器演变成一个复杂的浏览器,这得益于根据浏览器写出的非常有用和强大的扩展.作为一名开发人员,我们关注的是网页设计和开发部分的那些插件对我们有帮助,几个比较熟 ...

  5. linux basename学习

    basename 用法 basename 名称 [后缀]   例子 1. $: basename /tmp/test.sh 输出: test.sh 2. $: basename /tmp/test.s ...

  6. 关于命名空间namespace

    虽然任意合法的PHP代码都可以包含在命名空间中,但只有以下类型的代码受命名空间的影响,它们是:类(包括抽象类和traits).接口.函数和常量. 在声明命名空间之前唯一合法的代码是用于定义源文件编码方 ...

  7. OPEN(SAP) UI5 学习入门系列之三:MVC (上) - 模型

    这次我们来一起学习MVC,这个专题分为两个小节,本次主要是总览以及模型,下一次着重会介绍视图以及控制器,因为控制器其实没有太多可以讲的,所以和视图合并在一块. 1 Model View Control ...

  8. windows cmd 命令行 —— 进程与服务

    1. 进程查看与操作 tasklist tskill pid 2. 服务查看与操作 net start net stop

  9. day3 文件系统 内核模块 ctags

    nfs网络文件系统 smb   修改配置文件  sudo  vim /etc/samba/smb.conf    重启服务   /etc/init.d/samba restart 自制小的文件系统 1 ...

  10. Android学习笔记之Activity详解

    1 理解Activity Activity就是一个包含应用程序界面的窗口,是Android四大组件之一.一个应用程序可以包含零个或多个Activity.一个Activity的生命周期是指从屏幕上显示那 ...