如何修复/bin/sh:语法错误:意外的“(”而不更改为/bin/bash
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17944710/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to fix /bin/sh: syntax error: unexpected "(" without changing to /bin/bash
提问by Crazywiz Wiz
I have this makefile:
我有这个makefile:
SHELL = /bin/sh
INSTALL =/usr/bin/install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
STRIP=$(TARGET_CROSS)strip
EXEC=monApp
SRC= $(wildcard src/*.cpp)
OBJ= $(SRC:.cpp=.o)
CXX=$(TARGET_CROSS)g++
CXXFLAGS = -I./include –I$(STAGING_DIR)/include –I(STAGING_DIR)/usr/include/
LDFLAGS = -g -Wall -L$(STAGING_DIR)/lib –lEGL –lGLESv2 –lIMGegl –L$(STAGING_DIR)/usr/lib
all: $(EXEC)
$(EXEC): $(OBJ)
$(CXX) -o $@ $^ $(LDFLAGS)
%.o: %.cpp
@$(CXX) -o $@ -c $< $(CXXFLAGS)
.PHONY: clean
clean:
@rm -rf src/*.o
@rm -rf $(EXEC)
install: $(EXEC)
mkdir -p ./package.release
$(INSTALL_PROGRAM) $(EXEC) ./package.release/
$(STRIP) ./package.release/$(EXEC)
uninstall:
@rm -rf ./package.release/
How do I fix this issue without changing to /bin/bash (i do not have bash so i have to use sh)?
如何在不更改为 /bin/bash 的情况下解决此问题(我没有 bash 所以我必须使用 sh)?
Thank you,
谢谢,
回答by Armali
Since feature requests to mark a comment as an answerremain declined, I copy the above solution from J.F. Sebastian here.
由于将评论标记为答案的功能请求仍然被拒绝,我从这里复制了 JF Sebastian 的上述解决方案。
add missing $
to (STAGING_DIR)
in the CXXFLAGS
添加缺少$
对(STAGING_DIR)
在CXXFLAGS
回答by Dumisani Kunene
I removed parentheses from the project folder's name.
我从项目文件夹的名称中删除了括号。
CMAKE cannot build when the absolute path contains parentheses.
当绝对路径包含括号时,CMAKE 无法构建。
The error occurred when building a C++ project with Qt Creator and CMake:
使用 Qt Creator 和 CMake 构建 C++ 项目时出现错误:
/bin/sh: 1: Syntax error: "(" unexpected