如何在构建Arduino软件时包含目录

时间:2016-07-16 14:31:57

标签: makefile arduino include

我正在制作一个小型的Arduino项目。官方的Arduino IDE非常糟糕,所以我正在使用Netbeans开发。这是我的makefile:

OBJDIR          = ../build

ARDUINO_DIR = /usr/share/arduino

TARGET      = main

MCU     = atmega328p

F_CPU       = 16000000

ARDUINO_PORT    = /dev/ttyACM0
AVRDUDE_ARD_PROGRAMMER  = arduino
AVRDUDE_ARD_BAUDRATE    = 115200

include /usr/share/arduino/Arduino.mk

我想使用/usr/local/include/myproject中的一些标题,因此在我添加的源代码中添加:

#include "myproject/someheader.h"

现在,当我尝试编译项目时,我收到一条错误

fatal error: myproject/someheader.h: No such file or directory

如何在构建项目时包含/ usr / local / include目录?通常,我会添加

INC=-I/usr/local/include

但那不起作用,我想我需要以其他方式添加头文件?

1 个答案:

答案 0 :(得分:0)

结束了从arduino目录到我的库位置的符号链接:

ln -s /usr/local/include /usr/share/arduino/libraries/Custom

然后,我将“自定义”“库”添加到arduino makefile中,我的makefile现在是:

OBJDIR          = ../build

ARDUINO_DIR = /usr/share/arduino

TARGET      = main

MCU     = atmega328p

F_CPU       = 16000000

ARDUINO_PORT    = /dev/ttyACM0
AVRDUDE_ARD_PROGRAMMER  = arduino
AVRDUDE_ARD_BAUDRATE    = 115200
ARDUINO_LIBS    = Custom # <---- !

include /usr/share/arduino/Arduino.mk

构建过程似乎现在获取我的头文件