V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
salamanderMH
V2EX  ›  问与答

VS 2105 编译的 dll,在其他电脑上不能使用?

  •  
  •   salamanderMH · 2019-11-17 23:18:00 +08:00 · 1320 次点击
    这是一个创建于 1593 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题

    VC++写了个 dll 给 C#用,在其他电脑上用的时候发现无法找到 dll,我也装了 VC 2015 的 Runtime 了,可是还是报错,这是缺了什么呢?

    第 1 条附言  ·  2019-11-18 10:22:03 +08:00
    2105 是写错了,妈的,应该是 2015。
    6 条回复    2019-11-18 10:54:37 +08:00
    wbing
        1
    wbing  
       2019-11-17 23:25:17 +08:00 via iPhone
    编的 debug 版?
    si
        2
    si  
       2019-11-17 23:27:13 +08:00
    好像 debug 用的库和 release 的不一样,你看看是不是这个原因。
    或者用 depends 看看用到的 DLL 有没有缺少。
    anyele
        3
    anyele  
       2019-11-17 23:47:14 +08:00
    用 release 发布
    cjw1115
        4
    cjw1115  
       2019-11-17 23:47:17 +08:00   ❤️ 1
    了解下这篇文章
    https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=vs-2019

    vs code generation 里面的 runtime library 在 release 的时候,最好配置成 /MT
    tangmanger
        5
    tangmanger  
       2019-11-18 10:10:45 +08:00
    大概率有可能,我之前有遇到过,VS2010 编译的项目,copy 到只有 VS2013 的环境上 缺少某个 dll 导致应用崩溃的,你可以看看,可以看看系统日志是否有报错,另外可以用 depends 来查看 你编译后的 dll 的依赖,ps:提醒楼上,VS2015==Visual Studio 2015
    salamanderMH
        6
    salamanderMH  
    OP
       2019-11-18 10:54:37 +08:00
    @anyele @cjw1115 感谢,确实是没有用 release 的缘故, /MT 我也配置了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1025 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:36 · PVG 03:36 · LAX 12:36 · JFK 15:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.