可能与 Arduino 核心库的宏定义冲突

问题描述 投票:0回答:0

我有一个

CanUtils.h
头文件和
CanUtils.cpp
源文件,组织在以下目录树中:

Documents
|---Arduino
| |---libraries
|  |--- CanUtils 
|   |--- CanUtils.h
    |--- CanUtils.cpp

这些文件构成了我正在尝试创建的 CanUtils 库。

CanUtils.h
的内容如下:

#ifndef CanUtils_h
#define CanUtils_h

enum PRIORITY_LEVEL 
{
 LOW     = 6
};
#endif

CanUtils.cpp
的内容如下:

#include "CanUtils.h"

如您所见,它非常简单,但是当我尝试使用以下测试脚本包含该库时:

#include <CanUtils.h>

void setup() {
  // put your setup code here, to run once:
  
}

void loop() {
  // put your main code here, to run repeatedly:

}

编译后得到以下错误日志:

在 C:\AppData\Local\Temp rduino\sketches\FB4D0CAE5653D98D753CBC42EE69409D\sketch\library_tests.ino.cpp:1:0 中包含的文件中: C:AppData\Local\Arduino15\packages rduino\hardware vr .8。

arduino macros arduino-c++ name-clash
© www.soinside.com 2019 - 2024. All rights reserved.