Visual Studio C ++ - 未解析的符号__environ [英] Visual Studio C++ - unresolved symbol __environ

查看:339
本文介绍了Visual Studio C ++ - 未解析的符号__environ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS 2008并使用多线程调试(/ MTd)编译我的应用程序。
在链接时,我收到以下错误:

 错误LNK2001:未解析的外部符号__environ 



符号定义在哪里?



感谢
Dima

解决方案

当使用/ Md(或变体)时,符号 _environ _wenviron 由函数调用替换。您需要跟踪使用这些(过时和已弃用)符号的代码,并使它们使用正确的函数名称。我发现很多与您在 google



我发现了一些更多细节此处


在Unicode上下文中轮询_environ当使用/ MD或/ MDd
链接时,
是无意义的。对于CRT DLL,
程序的
类型(宽或多字节)是未知的。只创建多字节
类型,因为这是
最可能的情况。


_environ 到宽字符版本 _wenviron ,您的原始代码可能会工作。


I'm using VS 2008 and compile my application with Multi-threaded Debug (/MTd). At link time I receive the following error:

error LNK2001: unresolved external symbol __environ

Where the symbol is defined?

Thanks Dima

解决方案

When you are using /Md (or variants), the symbols _environ and _wenviron are replaced by function calls. You need to track down the code that uses these (obsolete and deprecated) symbols, and make them use the proper function names. I found lots of people with the same problem as you in google also.

I found some more detail here:

Polling _environ in a Unicode context is meaningless when /MD or /MDd linkage is used. For the CRT DLL, the type (wide or multibyte) of the program is unknown. Only the multibyte type is created because that is the most likely scenario.

If you change the use of the symbol _environ to the wide character version _wenviron, your original code will probably work.

这篇关于Visual Studio C ++ - 未解析的符号__environ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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