c++ 工程 应用autotools 生成makefile

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

c++ 工程 应用autotools 生成makefile

相关文章:

你感兴趣的文章:

标签云: