在Visual C ++中__PRETTY_FUNCTION__ [英] __PRETTY_FUNCTION__ in Visual C++

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

问题描述

在使用Visual Studio 2017(准确地说是15.5.6)中的Visual C ++时,我注意到GCC中的__PRETTY_FUNCTION__似乎有效! -至少在某种程度上……

While playing around with Visual C++ from Visual Studio 2017 (15.5.6 to be exact) I noticed that __PRETTY_FUNCTION__ from GCC seems to work! - to some degree at least…

在输入时确实显示了建议:

It did show up along suggestions while typing:

它的值也按预期显示在工具提示中:

Also it had its value shown in tooltip as expected:

,但是使用__PRETTY_FUNCTION__编译代码会导致错误:

And yet compiling the code using __PRETTY_FUNCTION__ results in an error:

error C2065: '__PRETTY_FUNCTION__': undeclared identifier

那么,有什么方法可以使其在Visual C ++中运行?也许包括一些?还是一些特殊的编译设置? (我认为我使用的是默认值.)为什么在所示示例中有效,但在实际使用中无效?!

So, is there any way to make it work in Visual C++? Some include perhaps? Or some special compilation settings? (I think I'm using default ones.) Why would it work in shown examples, but not in actual use?!

请注意,我不是在寻找__PRETTY_FUNCTION__的Visual C ++替代方案.我已经知道了我对这里的行为感到惊讶和好奇.

Note, that I'm not looking for Visual C++ alternatives for __PRETTY_FUNCTION__. I know them already. I'm just surprised and curious about the behavior here.

推荐答案

那么,有什么方法可以使其在Visual C ++中运行?也许包括一些?还是一些特殊的编译设置? (我认为我使用的是默认值.)为什么在所示示例中有效,但在实际使用中无效?!

So, is there any way to make it work in Visual C++? Some include perhaps? Or some special compilation settings? (I think I'm using default ones.) Why would it work in shown examples, but not in actual use?!

否.

Visual Studio将 Edison设计组 C ++前端用于InteliSense,如Visual C ++中所述团队博客的重建Intellisense

The Visual Studio uses the Edison Design Group C++ Front End for the InteliSense, as explained in the Visual C++ Team Blog's Rebuilding Intellisense and here, and not the Microsoft C++ compiler. This means that some of the features available to the Intellisense are not available in compile time.

EDG的 C ++前端文档提到其支持某些GCC预定义像第71页的__PRETTY_FUNCTION__-"1.13预定义的宏"以及Microsoft的__FUNCSIG__.

EDG's C++ Front End documentation mentions that its supports some of the GCC pre-defines like __PRETTY_FUNCTION__ on page 71 - "1.13 Predefined Macros" together with Microsoft's __FUNCSIG__.

您甚至可以通过键入__EDG_VERSION__并将鼠标悬停在其上来查看EDG的版本.

You can even see the version of the EDG by typing __EDG_VERSION__ and hovering over it.

这篇关于在Visual C ++中__PRETTY_FUNCTION__的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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