C ++:如何使用'弱'宏? [英] C++ : how use 'weak' macro?

查看:100
本文介绍了C ++:如何使用'弱'宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了这些宏来帮我测试函数是否定义。

这些代码有效,但与VS不兼容,所以我需要知道正确的宏ID:

#if defined __GNUC__ 
#define EVENT [[gnu :: weak]]
#elif defined __clang__
#define EVENT [[llvm :: weak]]
#elif define _MSC_VER
#define EVENT [[msvc :: weak]]
#endif

这些宏工作,但与Visual Studio不兼容...我尝试添加正确的'#elif',但我不知道VS宏ID ...可以任何人告诉我?

解决方案

问题在于我不知道你需要做什么。


<但是我发现了一些东西。以下是摘要版本。

 #elif defined __clang__ 
#elif define _MSC_VER




您应该将代码复制到剪贴板并粘贴到此处以确保准确获取代码。如果你这样做,那么代码有错误。如果你没有在这里进行复制和粘贴,那么我们无法确定代码
真正是什么。


i did these macro for help me test if the function is defined.
these code works, but isn't compatible with VS, so i need to know the right macros ID's:

#if defined __GNUC__
#define EVENT [[gnu::weak]]
#elif defined __clang__
#define EVENT [[llvm::weak]]
#elif define  _MSC_VER
#define EVENT [[msvc::weak]]
#endif

these macro works, but isn't compatible with Visual Studio... i tried add the right '#elif', but i don't know the VS macros ID's... can anyone tell me?

解决方案

The problem is that I don't know what you need to do.

I noticed something however. The following is a summarized version.

#elif defined __clang__
#elif define  _MSC_VER


You should copy the code to the clipboard and paste here to ensure you get the code accurately. If you did that for here then the code has a mistake. If you did not do the copy and paste for here then we can't be sure what the code really is.


这篇关于C ++:如何使用'弱'宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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