Missing separator in Makefile?

后端 未结 6 2077
迷失自我
迷失自我 2021-01-01 12:17

The following Makefile is not working and I am not sure what\'s going on.

CC = gcc
CFLAGS = -Wall -g

demo:
    ${CC} ${CFLAGS} demo.c -o demo
lib:
    ${CC}         


        
6条回答
  •  鱼传尺愫
    2021-01-01 12:54

    lib needs to be compiled as a library, not a program.

    Try changing it to:

    main:
        ${CC} ${CFLAGS} main.c lib.o -o main
    lib:
        ${CC} ${CFLAGS} lib.c -c -o lib.o
    

提交回复
热议问题