静态构建Windows应用程序时出错 [英] Error when statically building a windows application

查看:268
本文介绍了静态构建Windows应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,编译和工作正常,当我动态链接一切,但当我想有一个静态构建它,它将无法编译。

I have an application that compiles and works fine when i dynamically link everything, but when I want to have a static build of it it will not compile.

visual studio 2010我在静态库选项中设置了使用MFC选项。

In visual studio 2010 I set the Use MFC in a Static Library option.

当我这样做时,会收到以下错误:

When I do that I get this error:

错误1错误LNK2001:未解析的外部符号_wWinMain @ 16 LIBCMT.lib(wwincrt0.obj)

Error 1 error LNK2001: unresolved external symbol _wWinMain@16 LIBCMT.lib(wwincrt0.obj)

我尝试添加LIBCMT.lib作为附加库,这不改变任何东西。

I have tried adding LIBCMT.lib as an additional library, but that doesn't change anything.

有关如何解决这个问题的任何建议吗?

Any ideas on how to fix this problem?

推荐答案

它缺少的消息 WinMain 意味着你的项目的一些部分正在作为一个应用程序,而不是作为一个库。

From the message that it's missing WinMain that implies to me that some piece of your project is being built as an application and NOT as a library.

尝试完全重建,并确保所有相关选项都设置为构建静态库。我相信 libcmt.lib 应该只链接到你的最终应用程序,而不是链接到库。

Try a full rebuild and ensure that all relevant options are set to build a static library. I believe libcmt.lib should only be linked to your final application, NOT to the library.

这篇关于静态构建Windows应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆