我有一个程序,我有这个 make 文件,我试图用这个 makefile 运行我的程序,它编译得很好,问题是当我运行该程序时,我应该像这样运行它,./user -n tejo.tecnico.ulisboa.pt -p 58011或者-n tejo.tecnico.ulisboa.pt这个-p 58011是可选的。
我看到这篇文章将参数传递给“make run”,但我不明白我在 make run 命令中做错了什么
那么谁能告诉我我的 makefile 有什么问题吗?
顺便说一句,我在制作 makefile 和使用命令行方面相当陌生。
程序:
# Makefile
CC = g++
LD = g++
AUXLIB = auxiliar_code/aux_functions.h
SOCKETLIB = socket_operations/socket_functs.h
COMMANDSLIB = commands/commands.h
.PHONY: all clean run
all: client
client: socket_operations/socket.o auxiliar_code/aux.o commands/commands.o commands/client.o main.o
$(LD) -o user socket_operations/socket.o auxiliar_code/aux.o commands/commands.o commands/client.o main.o
auxiliar_code/aux.o: auxiliar_code/aux_functions.cpp $(AUXLIB) client_constants.h
$(CC) -o auxiliar_code/aux.o -c auxiliar_code/aux_functions.cpp
commands/client.o: commands/Client.cpp $(COMMANDSLIB) …Run Code Online (Sandbox Code Playgroud)