首页 > 解决方案 > :0:1: 错误:宏名必须是标识符........这个错误的解决方案?

问题描述

我正在尝试按照本指南将ssd1963 LCD 与 Raspberry Pi3 型号 B+ 连接Github

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

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

在此处输入图像描述

以下是我执行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

我是否可以为此获得解决方案或任何其他来源或链接的任何建议,我可以按照这些来源或链接来连接 ssd1963 LCD 并使用 Raspberrypi3 启用触摸。添加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

标签: linuxraspberry-pi3

解决方案


的(作者)Makefile没有考虑到环境变量DISPLAY可以定义为宏定义以外的其他东西。由于没有记录您是否需要以及如何定义它,因此您能做的最好的事情就是make使用 unset 变量:

(unset DISPLAY; make)

如果您更喜欢更改 makefile,只需删除?from DISPLAY?=ERROR,留下DISPLAY=ERROR.


推荐阅读