Makefile compile only the first file one makefile instructions

前端 未结 2 1249
故里飘歌
故里飘歌 2021-01-23 12:33
f1: f1.cpp f.h  
    g++ -c -Wall -g f1.cpp

f2: f2.cpp f.h  
    g++ -c -Wall -g f.cpp

This makefile does not compile f2.cpp to f2.

相关标签:
2条回答
  • 2021-01-23 12:39

    Is this the entire contents of your Makefile? If yes, then you're missing the all rule.

    all: f1 f2
    
    f1: dependencies
        intructions
    
    f2: dependencies
        intructions
    
    0 讨论(0)
  • 2021-01-23 13:02

    Because make only processes the first target (goal). To do both add this as the first rule:

    all: f1 f2
    
    0 讨论(0)
提交回复
热议问题