将VS2006 C ++代码迁移到VS2010(MFC)。错误LNK2001:未解析的外部符号___argv [英] Migrating VS2006 C++ code to VS2010 (MFC). Error LNK2001: unresolved external symbol ___argv

查看:81
本文介绍了将VS2006 C ++代码迁移到VS2010(MFC)。错误LNK2001:未解析的外部符号___argv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



我正在将应用程序从VS2006迁移到VS2010。



获取以下错误构建时:



Hello Everyone,

Am migrating an application from VS2006 to VS2010.

Getting below error while build:

Error	10	error LNK2001: unresolved external symbol ___argv	D:\Vishal\nseexchfeeds\Nafxcwd.lib(appcore.obj)
Error	11	error LNK2001: unresolved external symbol ___argc	D:\Vishal\nseexchfeeds\Nafxcwd.lib(appcore.obj)



Help me if someone is aware of this error.

Thanks.

What I have tried:

<pre>Please check below settings which i have made in this project:

Configuration settings: 

->Use of MFC: Use MFC in a Static Library

C/C++/ -> Code Generation:

Runtime Library: Multi-threaded (/MT)

Linker:

-> Additional Dependency:

Nafxcwd.lib
msvcrt.lib
msvcrtd.lib
kslzo.lib
ex25.lib
cts.lib
wininet.lib
wsock32.lib


-> IgnoreSpecificDefaultLibraries

libc.lib
libcmt.lib
libcmtd.lib

推荐答案

为什么忽略默认的LIBC库?



使用 / MT 选项时, libcmt。需要lib (resp。 libcmtd.lib 用于调试版本)。这些库包含启动使用的标准C库函数(可能还有全局 __ argc __ argv 变量)代码位于MSVCRT库中。



也没有必要将MSVCRT和其他标准Windows库指定为附加依赖项,因为它们在使用这些库中的函数时会自动链接(MSVCRT始终如此)。
Why do you ignore the default LIBC libraries?

When using the /MT option, libcmt.lib is required (resp. libcmtd.lib for debug builds). Those libraries contain the standard C library functions (and probably the global __argc and __argv variables) which are used by the startup code located in the MSVCRT library.

There is also no need to specify MSVCRT and other standard Windows libraries as additional dependancies because they are automatically linked when using functions from those libraries (which is always true for the MSVCRT).


这篇关于将VS2006 C ++代码迁移到VS2010(MFC)。错误LNK2001:未解析的外部符号___argv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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