我很难理解编译错误/bin/sh:1:/a.out:在helloworld脚本中找不到

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

本文关键字:out helloworld 脚本 找不到 错误 编译 bin sh 难理解      更新时间:2023-10-16

当我使用众所周知的helloworld脚本时。我终于把所有的东西都准备好了,并修复了所有的错误,但当我编译这个新错误时,它会弹出,告诉我这个/bin/sh:1:/a.out:未找到。

hello.ccp文件的脚本如下:

#include <iostream>
int main()
 {
  std::cout << "Hello World!n";
  return 0;
 }

而我的makefile看起来是这样的:

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

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

复习手册。目标a.out,因为这是要创建的。因此,将hello.ccp更改为a.out。由于hello.cppa.out先决条件,Makefile需要如下所示:

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

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