FASTSHIFT / Arduino-For-Keil

A lightweight Arduino framework for Keil projects.
MIT License
354 stars 130 forks source link

Print.h和Printable.h报错 #11

Closed kehale closed 2 years ago

kehale commented 4 years ago

我在使用其他.c文件加载#include "FileGroup.h",这个FileGroup.h前面有×,无法build,显示..\ArduinoAPI\Printable.h(25): error: #20: identifier "class" is undefined,..\ArduinoAPI\Print.h(101): error: #169: expected a declaration。我是初学者,在这麻烦你解决下,谢谢,最近下载的文件,是最新的。使用main.cpp,build是没有问题的,就是其他的.c文件加头文件include "FileGroup.h"build出错

FASTSHIFT commented 4 years ago

@kehale identifier "class" is undefined 说明没有用C++编译器 您用的是什么版本的keil

kehale commented 4 years ago

5.14

FASTSHIFT commented 4 years ago

关于"FileGroup.h"前面的x号,可以尝试 Options for target->C/C++->Misc Controls 里的"--gnu"去除

FASTSHIFT commented 4 years ago

可能是keil版本导致的,建议换5.25版本,我编译没问题。

kehale commented 4 years ago

嗯。谢谢了

FASTSHIFT commented 4 years ago

另外,.c里不能直接调用C++,不能引用C++的头文件,您需要把.c文件的扩展名改为.cpp

kehale commented 4 years ago

谢谢了 是c++的问题的解决了