【问题标题】:Command not found in C++ Makefile for CS [closed]在 CS 的 C++ Makefile 中找不到命令 [关闭]
【发布时间】:2020-04-27 04:23:17
【问题描述】:

我正在尝试为我的 c++ 项目制作一个 makefile,但是我收到了这个错误:

flip1 ~/cs162/program2 1049$ make
c card.cpp
make: c: Command not found
make: [card.o] Error 127 (ignored)
c deck.cpp
make: c: Command not found
make: [deck.o] Error 127 (ignored)
g++ card.o deck.o hand.o main.o -o prog2
g++: error: card.o: No such file or directory
g++: error: deck.o: No such file or directory
make: *** [prog2] Error 1

我的 makefile 看起来像这样:

CC = g++
exe_file = prog2
$(exe_file): card.o deck.o hand.o main.o
    $(CC) card.o deck.o hand.o main.o -o $(exe_file)

card.o: card.cpp
    $(cc) -c card.cpp
deck.o: deck.cpp
    $(cc) -c deck.cpp
hand.o: hand.cpp
    $(CC) -c hand.cpp
main.o: main.cpp
    $(CC) -c main.cpp

clean:
    rm -f *.out *.o $(exe_file)

有什么想法吗?

【问题讨论】:

    标签: c++ makefile gnu-make


    【解决方案1】:

    问题在于我的编译器目标 CC = g++ 使用了大写 Cs,而在第 7 行和第 9 行我使用了小写 cs。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-28
      • 1970-01-01
      • 2014-09-10
      • 2014-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多