错误:使:***没有规则制定目标的main。c”,需要“main.o”。停止

时间:2021-08-22 01:55:56
CC= gcc

CFLAGS= -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XSLT=1 \
  -DXMLSEC_NO_XKMS=1 -I/usr/include/libxml2 -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 \
  -DXMLSEC_CRYPTO=\"openssl\" -DUNIX_SOCKETS -DXML_SECURITY -DDEBUG \
  -I/usr/local/include/xmlsec1 -lxmlsec1 

LDFLAGS= -lcrypto -I/usr/include/libxml2 -I/usr/local/include/xmlsec1 \
  -lxmlsec1 -lprotobuf-c

default: shr
#pb stands for protobuf file

shr:    main.o  file2.o file3.pb-c.o
            $(CC)   $(CFLAGS)   -o shr main.o   file2.o file3.pb-c.o

main.o: main.c  header.hfile2.h file3.h
                $(CC)   $(CFLAGS)   -c main.c

file2.o:    file2.c file2.h
                $(CC)   $(CFLAGS)   -c axisuid_auth.c

file3.pb-c.o:   file3.pb-c.c    file3.h
                $(CC)   $(CFLAGS)   -c file3.c

clean:
        $(RM)   shr *.o *~  

1 个解决方案

#1


4  

As you said, all the .c and .h files are in src folder. So in that case in your Makefile you should specify it as src/main.c

正如您所说,所有的.c和.h文件都在src文件夹中。在Makefile中,应该将其指定为src/main.c。

#1


4  

As you said, all the .c and .h files are in src folder. So in that case in your Makefile you should specify it as src/main.c

正如您所说,所有的.c和.h文件都在src文件夹中。在Makefile中,应该将其指定为src/main.c。