make: implicit rule to link c++ project

后端 未结 7 904
礼貌的吻别
礼貌的吻别 2020-12-31 04:52

I am working my way through a make tutorial. Very simple test projects I am trying to build has only 3 files: ./src/main.cpp ./src/implementation.cpp and

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 05:27

    The implicit rule for linking object files is:

    $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
    

    But $(LINK.o) uses $(CC), which is not quite correct for compiling C++ programs, so the easiest fix is:

    CC = $(CXX)
    

提交回复
热议问题