VS中的__PRETTY_FUNCTION__报错的问题

https://stackoverflow.com/questions/48857887/pretty-function-in-visual-c

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'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__.

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

You can emulate it pretty well by putting this in some common header (for example, your precompiled header, if you're using that):

#if !defined(__PRETTY_FUNCTION__) && !defined(__GNUC__)
#define __PRETTY_FUNCTION__ __FUNCSIG__
#endif

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果在 PostgreSQL 使用 `pg_size_pretty` 函数时出现错误,可能是因为该函数不在当前的数据库模式可用。你可以尝试通过以下两种方式解决问题: 1. 使用完全限定的函数名称:`pg_catalog.pg_size_pretty` 例如,将查询语句的 `pg_size_pretty` 替换为 `pg_catalog.pg_size_pretty`。这将确保使用完整的函数路径,而不仅仅是函数名称。 ```sql SELECT pg_catalog.pg_size_pretty(pg_total_relation_size(current_database())) AS total_size, pg_catalog.pg_size_pretty(pg_database_size(current_database())) AS database_size; ``` 2. 切换到正确的数据库模式 在 PostgreSQL ,函数可以位于不同的模式。如果 `pg_size_pretty` 函数位于其他模式而不是默认的模式,你需要切换到该模式才能使用它。 首先,可以通过以下查询语句查看函数所在的模式: ```sql SELECT proname, pronamespace::regnamespace AS schema FROM pg_proc WHERE proname = 'pg_size_pretty'; ``` 查询结果将显示函数 `pg_size_pretty` 的模式。然后,你可以使用以下命令切换到正确的模式: ```sql SET search_path TO schema_name; ``` 其,`schema_name` 是函数所在的模式名称。切换到正确的模式后,你应该能够正常使用 `pg_size_pretty` 函数。 请注意,以上解决方法假设你具有足够的权限来执行这些操作。如果你没有足够的权限或者遇到其他问题,请联系数据库管理员进行进一步的支持和调试。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值