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

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

    1.设置行数和列数 //设置行数 tableWidget->setRowCount(); //设置列数 tableWidget->setColumnCount(); 2.隐藏表头 tabl ...

  2. 连接GitHub的方法

    连接到GitHub 首先在本地创建 ssh key: ssh-keygen -t rsa -C "your_email@youremail.com" 后面的 your_email@ ...

  3. 【51nod-1091】线段的重叠(贪心)

    所有线段按起点从小到大排序,然后比较出最大的重叠部分.比如第i条线段和第j条线段进行比较找出重叠部分(j>i),当第j条线段的右端点<第i条线段的右端点,此时可以让i继续比较后面的线段:如 ...

  4. C#学习历程(四)[实际问题]

    >>无法直接启动带有”类库输出类型”的项目 在编辑界面的右侧会出现[解决方案资源管理器],里面显示我们的程序项目和所有代码文件. 右键点击项目,在右键菜单中选择[属性] 一般导致该问题都是 ...

  5. C#学习历程(五)[高阶概念]

    >>修饰符的访问权限 private : 私有成员, 在类的内部才可以访问. protected: 保护成员,该类内部和继承类中可以访问. public: 公共成员,完全公开,没有访问限制 ...

  6. gridview 后台增加列

    BoundField field1 = null; field1 = new BoundField();  //实例化 field1.HeaderText = "序号";field ...

  7. LeetCode OJ:Swap Nodes in Pairs(成对交换节点)

    Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2-&g ...

  8. 原生js重写《锋利的JS》之 轮播效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. weblogic、hibernate 包冲突

    解决办法: 在weblogic 配置  [paths]项中 添加antlr-2.7.7.jar,该jar包应该位于引用weblogic.jar之前,使启动时不再加载weblogic中的低版本的antl ...

  10. 锐捷S2126交换机端口限速

    一.对于S21的进入(上行)的数据的限速,可以用Qos做到. ip access-list extended acl_1                配置ACLpermit ip 172.16.41 ...