日期:2014-05-16  浏览次数:20656 次

c++ 工程 使用autotools 生成makefile
我使用autotools 生成makefile ,过程如下:

hello.cpp文件
#include<iostream>
using namespace std;
int main()
{
  cout<<"hello,world!\n"<<endl;
  return 1;
}
使用 autoscan命令
编辑 confinure.in
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE([foreign])
#AC_CONFIG_SRCDIR([hello.cpp])
#AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

命令aclocal
命令autoconf

编写Makefile.am
bin_PROGRAMS=hello
hello_SOURCES=hello.cpp

命令automake

./configure
make

出现错误
make: *** 没有规则可以创建“hello.o”需要的目标“hello.c”。 停止


命令行:g++ hello.cpp
没有问题

请问哪里错了,高手指点

------解决方案--------------------
我按照你的步骤执行了一遍,是可以通过的,用了“automake --add-missing“。其他都是一样的,你可以在configure.in里加上“AC_PROG_C”,试一试
------解决方案--------------------
你可以试试CMake