且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

make:c:找不到命令

更新时间:2023-11-16 15:52:22

您需要从 $ g ++ 行中删除 $ 。它试图扩展一些不存在的变量,并从你的命令吞下 $ g ++ -

You need to remove the $ from the $g++ lines. It's trying to expand some variable that doesn't exist, and is swallowing up the "$g++ -" from your commands.

使用变量的语法是:

$(CXX) -c main.cpp

在这种情况下, CXX 是C ++编译器的路径,这是为您定义的。您可以通过在makefile中添加以下行来更改它:

In this case, CXX is the path to the C++ compiler, which is defined for you. You can change it by adding the following line to your makefile:

CXX = g++

如果您试图避免回显命令make正在运行,请使用 @ $

If you are trying to avoid echoing back the command make is running, use @ instead of $.