makefile出现gcc:command not found问题
大家帮我看一下是怎么回事?
OPTS = -Wall -Werror
PATH = /usr/local/mysql
INCLUDE = $(PATH)/include/mysql
LIB = $(PATH)/lib/mysql
all: server client
.PHONY: all
server: server.o operate.o
@gcc $^ -o $@ $(LIB)/libmysqlclient.a -lz
client: client.o operate.o
@gcc $^ -o $@ $(LIB)/libmysqlclient.a -lz
server.o: server.c operate.h exception.h
@gcc $(OPTS) -c $< -o $@ -I$(INCLUDE)
client.o: client.c operate.h exception.h
@gcc $(OPTS) -c $< -o $@ -I$(INCLUDE)
operate.o: operate.c operate.h exception.h
@gcc $(OPTS) -c $< -o $@ -I$(INCLUDE)
.PHONY: clean
clean:
@rm -f client.o operate.o server.o
当make时,会出现
make: gcc: command not found
如果在makefile中不使用变量的话,就没这问题。
这是怎么回事啊?
------解决方案--------------------server: server.o operate.o
@gcc $^ -o $@ $(LIB)/libmysqlclient.a -lz
@gcc前面加上一个tab键试试
------解决方案--------------------你设置了PATH值,使它指向了错误的路劲。应该是这样。
------解决方案--------------------楼上说的有道理,PATH貌似是系统的变量,不能这样直接赋值
------解决方案--------------------