help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compile error


From: Sam
Subject: compile error
Date: Thu, 09 Sep 2004 07:18:32 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

Hello
I am trying to compile this simple hello world but having some errors which I can't find out why. I would appreciate some help.

Thanks

the error appears when I am running "$make" the last step in the run script at the bottom of this post.
********************The Error*******************************
make[3]: Entering directory `/home/sam/Hello_world/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. ./print -g -O2 -MT hello.o -MD -MP -MF ".deps/hello.Tpo" -c -o hello.o hello.cpp; \ then mv -f ".deps/hello.Tpo" ".deps/hello.Po"; else rm -f ".deps/hello.Tpo"; exit 1; fi
g++: cannot specify -o with -c or -S and multiple compilations
make[3]: *** [hello.o] Error 1
make[3]: Leaving directory `/home/sam/Hello_world/src'
**************************************************************

 :~/Hello_world$ tree.
 =============
 |-- Makefile.am
 |-- configure.ac
 |-- run
 `-- src
 ***|-- Makefile.am
 ***|-- hello.cpp
 ***`-- prnt
 *****|-- Makefile.am
 *****|-- print.cpp
 *****`-- print.h

Hello_world/Makefile.am
===============
SUBDIRS = src

Hello_world/configure.ac
================
AC_INIT(src/hello.cpp)
AC_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(hello,0.1)
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_OUTPUT(Makefile src/Makefile src/prnt/Makefile)

Hello_world/src/Makefile.am
==================
bin_PROGRAMS = hello
hello_SOURCES = hello.cpp
SUBDIRS = prnt .
LDADD = prnt/libprint.a
INCLUDES = $(srcdir)/print

Hello_world/src/prnt/Makefile.am
=====================
noinst_LIBRARIES = libprint.a
libprint_a_SOURCES = print.h print.cpp

Hello_world/src/hello.cpp
===============
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "print.h"
#include <iostream>

int main(){
   print( "I am ok for now" );
   return 0;
 }


Hello_world/src/prnt/print.h
==================
#ifndef PRINT_H
#define PRINT_H

#include <string>
void print(std::string);

#endif

Hello_world/src/prnt/print.cpp
===================
#include "print.h"
#include <iostream>
#include <string>

void print(std::string s){
   std::cout << s << std::endl;
}

Hello_world/run
===========
#!/bin/bash

echo "*************************libtoolize"
libtoolize

echo "*************************autoheader"
autoheader

echo "***************************touching"
touch NEWS README AUTHORS ChangeLog stamp-h


echo "****************************aclocal"
aclocal

echo "***************************autoconf"
autoconf

echo  "***************************automake"
automake -a

echo "*************************configuring"
./configure

echo "******************************making"
make


reply via email to

[Prev in Thread] Current Thread [Next in Thread]