如何在"ioctl"之前修复"expected'=",“,",“;","asm"或"__attribute__"错误 ? [英] How to fix "expected '=', ',', ';', 'asm' or '__attribute__' before 'ioctl' " error ?

查看:178
本文介绍了如何在"ioctl"之前修复"expected'=",“,",“;","asm"或"__attribute__"错误 ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows平台上的Code Composer Studio中实现嵌入式c程序时,遇到了以上错误.

此错误出现在此行的"ioctl.h"文件中:
int __cdecl ioctl(int __fd,int __cmd);

如何解决此错误?

I got above error, while implementing an Embedded c program, in code composer studio, on windows platform.

This error comes in ''ioctl.h'' file at this line :
int __cdecl ioctl (int __fd, int __cmd);

How to fix this error ?

推荐答案

您可能正在使用gcc,它抱怨编译器和处理器特定的__cdecl.如果嵌入式系统未使用x86 CPU,则可以使用空的全局定义将其隐藏:
You are probably using gcc which complains about __cdecl which is compiler and processor specific. If your embedded system does not use a x86 CPU you may use an empty global definition to hide it:
#define __cdecl


但是,可能还会出现其他问题,因此您应该检查是否可以为目标平台设置开发环境.

对于x86 CPU,gcc使用__attribute__指定C调用约定,您可以使用:


However, there may be other issues coming up so you should check if you can setup your development environment for your target platform.

With x86 CPUs, gcc uses __attribute__ to specify the C calling convention and you can use:

#define __cdecl __attribute__((__cdecl__))



如有其他疑问,您应提供有关所用编译器(名称和版本)和目标平台(体系结构和OS)的其他信息.



For further questions you should provide additional information about the used compiler (name and version) and target platform (architecture and OS).


这篇关于如何在"ioctl"之前修复"expected'=",“,",“;","asm"或"__attribute__"错误 ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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