make:***没有规则要制作目标`main.c',需要`main.o'

时间:2015-11-25 10:31:10

标签: c++ automake

我刚刚开始使用GNU Build工具,而且我一直在尝试使用C ++源代替C源来重现hello world示例(Creating-amhello)。
但是,我收到标题中指出的错误。以下是我正在使用的修改过的教程文件。

src / main.cpp:

#include <config.h>
#include <stdio.h>

int
main (void)
{
  puts ("Hello World!");
  puts ("This is " PACKAGE_STRING ".");
  return 0;
}

的src / Makefile.am:

bin_PROGRAMS = hello
hello_SOURCES = main.cpp

configure.ac:

AC_INIT([amhello], [1.0], [bug-automake@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CXX
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
 Makefile
 src/Makefile
])
AC_OUTPUT

1 个答案:

答案 0 :(得分:0)

您必须使用以下内容创建另一个Makefile.am:

SUBDIRS = src