Linkage problem when compiling C++ program

Cassé Hugues <[email protected]> Mon, 29 Aug 2005 13:18:43 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
  I'm compiling a C++ program on a Linux machine. The compilation works 
well but the linkage use the link command for simple C program.   When I 
run AAP, it produces the following link command (this is an excerpt from 
the log file) :

extra:    Shell commands for updating "test{comment=build program 
"test"}{virtual=1}{filetypehint=program}":
system:    cc  -O2 -o test 
build-Linux2_6_11_6mdk_i686_up_4GB/test_string_buffer.o
log:    
build-Linux2_6_11_6mdk_i686_up_4GB/test_string_buffer.o(.text+0x4a): In 
function `test_string_buffer()':
: undefined reference to `operator new[](unsigned int)'
build-Linux2_6_11_6mdk_i686_up_4GB/test_string_buffer.o(.text+0x1b2): In 
function `test_string_buffer()':
: undefined reference to `operator new[](unsigned int)'
build-Linux2_6_11_6mdk_i686_up_4GB/test_string_buffer.o(.text+0x397): In 
function `test_string_buffer()':
: undefined reference to `operator delete[](void*)'
...

  Indeed, as the linker is "cc", default C++ libraries are not linked 
and "new" and "delete" operator cannot be resolved.

(1) do I do something bad in my main.app file ? The main.app is below:

:conf language C++

INCLUDE = -I../include
LIBS =  -L../src -lelm

TEST_SOURCES        =\
                        test_string_buffer.cpp \
                        test_sorted_bintree.cpp \
                        test_dllist.cpp \
                        test_plugin.cpp \
                        test_avl.cpp \
                        test_sllist.cpp \
                        test_bitvector.cpp \
                        test_string.cpp \
                        test_utility.cpp \
                        test_vector.cpp \
                        test_hashtable.cpp \
                        test_lock.cpp \
                        test_file.cpp \
                        test.cc

all: test

:program test : $TEST_SOURCES

(2) Else how does one compile C++ program with AAP ?

  Thank your for your answer, H. Cassé
casse.vcf (text/x-vcard, 265 B)
begin:vcard
fn;quoted-printable:Hugues Cass=C3=A9
n;quoted-printable:Cass=C3=A9;Hugues
org:IRIT-UPS;TRACES
adr:;;118 route de Narbonne;Toulouse;;31062;France
email;internet:[email protected]
title:MCF
tel;work:05 61 55 63 60
version:2.1
end:vcard