语法错误:单词意外(期望“)")?

问题描述:

PLATFORM = x86
CUD = cuda
X86 = x86
PAN = panda
ARM = arm

app: 
    ifeq($(PLATFORM),$(CUD))
CC = dum3
endif
ifeq($(PLATFORM), $(X86))
CC = gcc
endif
ifeq($(PLATFORM),$(PAN))
CC = dum1
endif
ifeq($(PLATFORM),$(ARM))
CC = dum2
endif


$(CC) -o ./Executable/list  ./Source/ll_main.c ./Library/liblst.a
./Executable/list

当我这样做时,它显示错误.... 语法错误:单词意外(期待)")?

When I make this it shows error.... Syntax error: word unexpected (expecting ")") ?

Plzz ..帮助..

Plzz.. Help..

您的问题(makefile和错误消息)的格式太混乱了,无法确定,但是我怀疑您的ifeq是缩进的用TAB.

The formatting in your question (both the makefile and the error message) is too messed up to be sure, but my suspicion is that your ifeq is indented with a TAB.

那是不对的; ifeq make 命令. (几乎)所有带有TAB字符的行都作为makefile中该行的第一个字符传递给 shell .外壳程序对ifeq一无所知,因此,根据您的外壳程序,可能会打印出这样的错误.

That's not right; ifeq is a make command. (Almost) all lines with TAB characters as the first character on the line in a makefile is passed to the shell. The shell doesn't know anything about ifeq, so, depending on your shell, might print an error like that.

您应该在ifeq块之后将app:目标移到使用$(CC)之前(并确保$(CC) ...行以TAB作为该行的第一个字符缩进).

You should move the app: target after the ifeq blocks to just before the use of $(CC) (and ensure the $(CC) ... line is indented with a TAB as the first character on that line).

将来,请务必使用SO的格式化功能,请务必准确地剪切和粘贴错误消息,并在提出问题时前后添加几行上下文.

In the future please be sure to use SO's formatting capabilities, and be sure to cut and paste error messages exactly, plus a few lines of context before and after, when asking questions.