Visual Studio Linker Warning LNK4099

在Visual Studio 下链接debug 版本的程序的时候,要求被链接的目标文件对应的pdb存在,这就要求依赖库在发布debug版本的时候也一并把pdb 文件发布。 如果链接的时候找不到pdb文件就会有这个Warning 消息跳出来。 那么链接器是怎么知道链接到哪个pdb文件的呢? 参考MSDN上的这篇文章 . 可以知道链接的pdb文件名,但是需要注意的是,pdb文件名对于库里面的每个目标文件都是独立的, 也就是说一个lib里面所包含的每个.obj文件的关联pdb文件都可以不一样。当然一般情况下都是一样的。

按照下面的步骤我们来看看如果获取某个库(.lib)下面某个目标文件(.obj)对应的pdb文件名。假设我们现在链接到opencv_highgui310d.lib这个库,然后链接时候报出Warning,说这个库里面的window.obj的pdb文件找不到,我们该如何确定window.obj相关联的pdb文件呢?


  • 列出opencv_highgui310d.lib的目标成员

命令:
   lib /LIST opencv_highgui310d.lib

输出:
    opencv_highgui.dir\Debug\window.obj
    opencv_highgui.dir\Debug\window_w32.obj
    opencv_highgui.dir\Debug\opencv_highgui_pch.obj
  • 从opencv_highgui310d.lib中提取window.obj文件

命令:
     lib /EXTRACT:opencv_highgui.dir\Debug\window.obj opencv_highgui310d.lib

该命令在当前目录下生成了window.obj文件
  • 从window.obj提取编译时的关联pdb文件路径和名称
命令:
         dumpbin /section:.debug$T /rawdata window.obj

输出 :
        Dump of file window.obj
        File Type: EXTENDED COFF OBJECT

SECTION HEADER #3
.debug$T name
       0 physical address
       0 virtual address
      70 size of raw data
    4236 file pointer to raw data (00004236 to 000042A5)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
42100040 flags
         Initialized Data
         Discardable
         1 byte align
         Read Only

RAW DATA #3
  00000000: 04 00 00 00 6A 00 15 15 74 8C 65 6D CD CA 70 4F  ....j...t.emÍÊpO
  00000010: B8 DF 83 D1 3F 04 86 FE 02 00 00 00 44 3A 5C 50  ¸ß.Ñ?..þ....D:\P
  00000020: 72 6F 6A 65 63 74 73 5C 66 72 61 6D 65 77 6F 72  rojects\framewor
  00000030: 6B 2D 6C 69 62 73 5C 76 73 32 30 31 35 2D 77 69  k-libs\vs2015-wi
  00000040: 6E 36 34 5C 6F 70 65 6E 63 76 33 2E 31 5C 6C 69  n64\opencv3.1\li
  00000050: 62 5C 44 65 62 75 67 5C 6F 70 65 6E 63 76 5F 68  b\Debug\opencv_h
  00000060: 69 67 68 67 75 69 33 31 30 64 2E 70 64 62 00 F1  ighgui310d.pdb.ñ

这样我们就很清晰的看到了编译opencv_highgui310d.lib时,在D:\Projects\framework-libs\vs2105-win64\opencv3.1\lib\Debug\目录下一并生成了opencv_highgui310d.pdb文件。现在去编译机器上相应的目录下面把这个pdb文件拷贝到你当前机器的opencv_highgui310d.lib同一个目录下,问题就解决了!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
DriverStudio 3.2 For VisualStudio 2005 补丁<br><br>解决DriverStudio 3.2插件在VisualStudio 2005中无法使用的问题。<br><br>原文件说明:<br><br>Compuware DriverStudio – DriverSuite<br>Version 3.2<br><br>Version 3.2 VisualStudio 2005 Integration fix.<br>The purpose of this update is to allow DriverStudio – DriverSuite to integrate into the VisualStudio 2005 environment<br><br>After extracting the files the result should have been two files and this read me. To install perform the steps below.<br><br>· Close all development environment windows.<br><br>· Copy the file DSDDKEnv8.dll into the <INSTALL_DIR>\DriverStudio\Common\Bin directory. Select "yes" if prompted to copy over an existing one.<br><br>· Copy the file DSDDKEnv8UI.dll into the <INSTALL_DIR>\DriverStudio\Common\Bin\1033 directory. Select "yes" if prompted to copy over an existing one.<br><br>· Then unregister the older version. Go to start->run and type "regsvr32 -u "<INSTALL_DIR>\DriverStudio\Common\Bin\dsddkenv8.dll"<br><br>· Then register the new copy. Go to start->run and type "regsvr32 "<INSTALL_DIR>\DriverStudio\Common\Bin\dsddkenv8.dll"<br><br>Contacting Technical Support<br>For Non-Technical Issues<br>Customer Service is available to answer any questions you might have regarding upgrades, serial numbers and other order fulfillment needs. Customer Service is available from 8:30am to 5:30pm EST, Monday through Friday. Call:<br><br>· In the U.S. and Canada: 1-888-283-9896<br><br>· International: +1-603-578-8103<br><br>For Technical Issues<br>Technical Support can assist you with all your technical problems, from installation to troubleshooting. Before contacting Technical Support, please read the relevant sections of the product documentation and the Readme files.<br><br>You can contact Technical Support by:<br><br>· E-Mail: Include your serial number and send as many details as possible to:<br><br>[email protected]<br><br>· World Wide Web: Submit issues and access additional support services at:<br><br>http://frontline.compuware.com/nashua/<br><br>· Fax: Include your serial number and send as many details as possible to:<br><br>1-603-578-8401<br><br>· Telephone: Telephone support is available as a paid* Priority Support Service from 8:30am to 5:30pm EST, Monday through Friday. Have product version and serial number ready.<br><br>·In the U.S. and Canada, call: 1-888-686-3427<br><br>·International customers, call: +1-603-578-8100<br><br>*Installation Issues: Technical Support handles installation and setup issues free of charge.<br><br>When contacting Technical Support, please have the following information available:<br><br>· Product/service pack name and version.<br><br>· Product serial number.<br><br>· Your system configuration: operating system, network configuration, amount of RAM, environment variables, and paths.<br><br>· The details of the problem: settings, error messages, stack dumps, and the contents of any diagnostic windows.<br><br>· The details of how to reproduce the problem (if the problem is repeatable).<br><br>· The name and version of your compiler and linker and the options that you used in compiling and linking.<br><br> <br><br>Copyright 2005 Compuware Corporation<br>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值