繁体   English   中英

如何设置Visual Studio以了解GCC定义?

[英]How can I set up Visual Studio to understand GCC defines?

我在C中有一个项目,并且在头文件中定义了以下代码,

/*_INLINE_ define for abstraction of the keyword inline*/
#define INLINE    __inline__

我已经使用GCC为Tricore微控制器编译了该项目,现在我必须使用Visual Studio 2010编译相同的项目以进行仿真。

但是,Visual Studio编译器显示以下错误:

error C2054: expected '(' to follow '__inline__' 

如何设置Visual Studio来了解此定义?

__inline__GCC专用关键字 ,而不是宏。 您所要做的就是找出与该关键字等效的MSVC,然后根据运行哪个编译器来更改宏INLINE的内容。

MS文档似乎表明该关键字的MSVC表示形式为__inline 因此,您应该这样修改标题:

#ifdef __GNUC__
  #define INLINE __inline__
#elif defined _MSC_VER
  #define INLINE __inline
#else
  // Some kind of default, or error out
#endif

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM