我无法理解编译错误 /bin/sh: 1: ./a.out: not found with hello world script

I am having trouble understanding a compiling error /bin/sh: 1: ./a.out: not found with hello world script

当我使用众所周知的 hello world 脚本时。我终于把所有东西都准备好并修复了所有错误但是当我编译这个新错误时弹出告诉我这个 /bin/sh: 1: ./a.out: not found.

对于 hello.ccp 文件,我的脚本如下所示:

#include <iostream>

int main()
 {
  std::cout << "Hello World!\n";
  return 0;
 }

虽然我的 makefile 看起来像这样:

hello.ccp:
    g++ -std=gnu++11    hello.cpp

有什么想法吗?非常感谢!

复习 manual目标a.out,因为这是您想要创建 的目标。所以把hello.ccp改成a.out。由于 hello.cppa.out 先决条件 ,Makefile 需要如下所示:

a.out: hello.cpp
    g++ -std=gnu++11 hello.cpp

此外,请确保您使用的是制表符而不是空格来缩进食谱。 Makefile 需要制表符。