如何构建记事本++使用 Visual C++ 2010年快递?

发布于 2024-09-19 10:08:03 字数 403 浏览 4 评论 0原文

Windows SDK 已安装。我之前用 Visual C++ 2008 Express 成功构建了 N++。但现在到了 2010 年,我收到了很多关于 sprintf_s 的错误消息:

1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string(676): error C2039: 'sprintf_s' : is not a member of '`global namespace''
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string(676): error C3861: 'sprintf_s': identifier not found

请帮忙。

Windows SDK is installed. I built N++ successfully with Visual C++ 2008 Express before. But now with 2010 I have a lot of error messages about sprintf_s:

1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string(676): error C2039: 'sprintf_s' : is not a member of '`global namespace''
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string(676): error C3861: 'sprintf_s': identifier not found

Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雪落纷纷 2024-09-26 10:08:03

项目中包含一个名为 no_ms_shit.props 的属性表(转换后)。该表中表达了对 MS 在过去 5 年里一直试图做的事情的相当多的仇恨。

他们关闭所有功能有点太过分了,他们甚至禁用了与 sprintf_s() 的链接。这是错误的根源,stdio.h 标头省略了声明,但字符串标头使用了它。不确定 Express 版本是否支持编辑项目属性表,但零售版中的步骤是:

  • 查看 + 属性管理器
  • 打开其中一个节点,找到“no msshit”
  • 右键单击它,属性
  • C/C++、预处理器、预处理器定义
  • __STDC_WANT_SECURELIB__=0 更改为 1
  • 将 _CRT_SECURE_NO_WARNINGS 添加到这些定义中

项目现在编译干净。我确实在复制文件时遇到构建错误,这是构建后事件。如果您不知道如何解决它,请开始另一个问题。

There's a property sheet included with the project named no_ms_shit.props (after conversion). There's a fair amount of hate expressed in that sheet for what MS has been trying to do for the past 5 years.

They went a little too over-board with turning everything off, they even disabled linking to sprintf_s(). Which is the source of your error, the stdio.h header omits the declaration but the string header uses it. Not sure if the Express edition supports editing project property sheets, but the step in the retail edition are:

  • View + Property Manager
  • Open one of the nodes and locate "no ms shit"
  • Right-click it, Properties
  • C/C++, Preprocessor, Preprocessor Definitions
  • Change __STDC_WANT_SECURELIB__=0 to 1
  • Add _CRT_SECURE_NO_WARNINGS to those definitions

The project compiles clean now. I do get a build error for copying files, it is a post-build event. Start another question if you can't figure out how to fix it.

南薇 2024-09-26 10:08:03

奇怪的。我有 Visual Studio 2010 Ultimate,它甚至不允许我访问“视图”->“属性页”菜单项。它对我来说是禁用的。

但我只是转到文件 no_ms_shit.props 并仅在 Notepad++ 中对其进行编辑:)。然后转到“项目”->“属性”->“配置属性”->“常规”,选择“否”将警告视为错误,并在预处理器定义中添加 _CRT_SECURE_NO_WARNINGS。

当 Don Ho 在 Windows 和 Visual Studio 中进行开发时,他应该顺其自然,而不是咒骂 ms 狗屎。


This worked for me when using Visual Studio 2012 Professional:

  • 您必须编辑no_ms_shit.vsprops(*.vsprops,不仅仅是*.props!):

    __STDC_WANT_SECURE_LIB__=0 替换为 __STDC_WANT_SECURE_LIB__=1

  • _CRT_SECURE_NO_WARNINGS添加到预处理器定义中。

Strange. I have Visual Studio 2010 Ultimate, and it even doesn't allow me to access the View->Property Pages menu item. It is disabled for me.

But I just went to the file no_ms_shit.props and edited that in Notepad++ only :). Then went to Project->Properties->Configuration Properties->General, and selected 'No' for treat warnings as Errors, and added _CRT_SECURE_NO_WARNINGS in the preprocessor definitions.

Don Ho should go with the flow than cursing the ms shit when he is developing in Windows and Visual Studio.


This worked for me when using Visual Studio 2012 Professional:

  • You have to edit no_ms_shit.vsprops (*.vsprops, not only *.props!):

    Replace __STDC_WANT_SECURE_LIB__=0 by __STDC_WANT_SECURE_LIB__=1

  • Add _CRT_SECURE_NO_WARNINGS to the preprocessor definitions.

嘴硬脾气大 2024-09-26 10:08:03

仔细查看源代码会发现,除非您使用此属性表,否则大多数会导致无尽噪音的库调用都来自 SciLexer.dll 项目。 Scintilla 是跨平台的,因此它不需要所有 Windows 特定的问题。正如您所提到的,Microsoft 过度替换了标准字符串库,尽管他们试图避免缓冲区溢出,但这样做是合法的。

因此,您可以将此批评指向 Neil Hodgson(Scintilla 的主要开发人员)而不是 Don Ho。

克里斯

A closer look at the source would show that most of the library calls that cause endless noise unless you use this property sheet come from the SciLexer.dll project. Scintilla is cross platform, so it doesn't need all the Windows specific cruft.As you mentioned, Microsoft went overboard with their replacing the standard string library, as legitimate as their attempt to avoid buffer overruns may be.

So you may direct this criticism to Neil Hodgson (main developer of Scintilla) rather than Don Ho.

CChris

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文