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

重要事项 运行时库现在包含防止混合不同类型的指令。如果试图在同一个程序中使用不同类型的运行时库
或使用调试和非调试版本的运行时库,则将收到此警告。例如,如果编译一个文件以使用一种运行时库,
而编译另一个文件以使用另一种运行时库(例如单线程运行时库对多线程运行时库),并试图链接它们,
则将得到此警告。应将所有源文件编译为使用同一个运行时库。有关更多信息,请参阅使用运行时库(/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. [Eclipse]Eclipse快捷键

    查看一个方法被谁调用:选中方法名字,Search-->Reference-->Workspace

  2. MySQL Cluster --01

    [MySQL Cluster] MySQL Cluster 是MySQL 官方集群部署方案, 支持自动分片.读写扩展:通过实时备份冗余数据.适合于分布式计算环境的高实用.高冗余版本,是可用性最高的方案 ...

  3. shell的初步介绍

    linux下Shell介绍 概述:每个人在成功登陆LIUX后,系统会出现不同的提示符号,例如$,~,#等,然后你就可以开始输入你需要的命令,若是命令正确,系统就会一句命令的要求来执行,知道注销系统位置 ...

  4. New Concept English there (6)

    30w/m The expensive shops in a famous arcade near Piccadilly were just opening. At this time of the  ...

  5. Python中的数据结构 --- 集合(set)

    1.集合(set)里面的元素是不可以重复的    s={1,2,3,3,4,3,4}      ## 输出之后,没有重复的 2.定义一个空集合 s = set([]) print s,type(s)3 ...

  6. iOS 11 实现App在禁止转屏的状态下网页播放器全屏

    禁止转屏是这个意思,在General中设置Device Orientation只有竖屏. 要点就是重写UIViewController的以下3个属性方法 系统的全屏视频播放器是AVFullScreen ...

  7. mssqlserver SQL注释快捷键

    注释快捷键 选中语句(快捷键:光标定位到需要注释块的最顶行,按住shift+home选中行,放开再按下shift+向下键,选中块) 按住Ctrl然后依次按K,C取消注释快捷键 选中语句 按住Ctrl然 ...

  8. Windows7下PHP 7.1搭建开发环境

    引言: PHP天生就是用来解决互联网时代的Web语言问题的专业工具,本文将记录在windows上搭建PHP的过程以及其中碰到的问题. 配置版本信息 OS: Windows 7 PHP: 7.1.7-n ...

  9. OPEN(SAP) UI5 学习入门系列之一:扫盲与热身(上)

    什么是SAP Fiori? 了解SAP UI5必须要从SAP Fiori开始,两者概念经常被混淆,而两者也确实有着非常紧密的关系. 用过SAP的同学们都对SAP的传统的界面(SAP GUI)表示“呵呵 ...

  10. CMake入门实践

    为了更好的代码管理,选择一款make工具非常重要,cmake取百家之长,现在在github上已经是工程管理的常客了,最大的优势是跨平台.本文将避开理论,直接教你如何在windows和linux上实现c ...