<命令行>:0:1:错误:宏名称必须是标识符........解决此错误的方法?

时间:2019-02-07 09:47:23

标签: linux raspberry-pi3

我正在按照Github上的本指南,尝试将 ssd1963 LCD与Raspberry Pi3 B +型接口。

  

https://github.com/matusnovak/rpi-tftgl

尝试在makefile目录中安装为rpi-tftgl提供的rpi-tftgl/tftgl时,我在运行make命令时收到此错误。 这是我捕获的pi终端窗口图像的链接,显示了确切的错误:

enter image description here

以下是我执行make命令时收到的错误:

gcc -c src/tftgl.c -o src/tftgl.o -I/opt/vc/include -I. -Iinclude -D:0 -O3
<command-line>:0:1: error: macro names must be identifiers
Makefile:18: recipe for target 'src/tftgl.o' failed
make: *** [src/tftgl.o] Error 1

我可以针对此问题或任何其他来源的建议找到解决方案,或者通过Raspberrypi3启用触摸功能来连接ssd1963 LCD的方法。 添加makefile,

 CC=gcc
 AR=ar
 DISPLAY?=ERROR
 CFLAGS=-I/opt/vc/include -I. -Iinclude -D$(DISPLAY) -O3
 prefix?=/usr/local

 .PHONY: default all clean

  default: tftgl
  all: default

  tftgl: libtftgl.a

  libtftgl.a: src/tftgl.o
     $(AR) rcs libtftgl.a src/tftgl.o

  src/tftgl.o: src/tftgl.c src/tftgl_ssd1963.h src/tftgl_ads7843.h
     $(CC) -c src/tftgl.c -o src/tftgl.o $(CFLAGS)

  install: tftgl
     install -m 0755 libtftgl.a $(prefix)/lib
     install -m 0644 include/tftgl.h $(prefix)/include

  clean:
     -rm -f src/*.o
     -rm -f libtftgl.a

我在这里提供了指向tftgl.c的链接, https://github.com/matusnovak/rpi-tftgl/blob/master/tftgl/src/tftgl.c

1 个答案:

答案 0 :(得分:0)

Makefile的(编写者)没有考虑到可以将环境变量DISPLAY定义为除宏定义之外的其他内容。由于尚未记录是否需要定义以及如何定义它,因此您最好的办法是使用变量unset来make

(unset DISPLAY; make)

如果您想更改Makefile,只需从?中删除DISPLAY?=ERROR,留下DISPLAY=ERROR

相关问题