[英]error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
An error occurred when i uploaded this code to Arduino Atmega2560. 当我将此代码上传到Arduino Atmega2560时发生错误。 This is a libary file which i have created for the .c files in my program. 这是我为程序中的.c文件创建的库文件。
The error is: 错误是:
herkulex.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
The word 'class' is highlighted when the error appears, which is in the file (code shown below) 错误出现时,“ class”一词突出显示,该错误在文件中(如下所示)
#ifndef herkulex_lib
#define herkulex_lib
#include <Arduino.h>
#include <Wire.h>
#include<inttypes.h>
class herkulex
{
public:
herkulex();
void hklx_Init(unsigned long ulBaudRate);
void hklx_SendPacket(DrsPacket stPacket);
unsigned char hklx_ucReceivePacket(DrsPacket *pstPacket);
void hklx_RemoveInvalidData(void);
//no private
};
#endif /* HERKULEX_H_ */
May I know what's wrong with this code? 我可以知道这段代码有什么问题吗? Thanks! 谢谢!
You are compiling a C file which contains C++. 您正在编译一个包含C ++的C文件。 The C compiler is rejecting C++ syntax. C编译器拒绝C ++语法。
Compile it as a C++ program instead. 而是将其编译为C ++程序。
是不是有一个space
在这里失去了:?
#include<inttypes.h>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.