[Top][All Lists]

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

Re: libtool uses cc to link a mixed C/C++ project and fails to find oper

From: John W. Eaton
Subject: Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new
Date: Tue, 25 Jun 2019 11:26:08 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1

On 6/23/19 2:56 PM, Yuri wrote:
On FreeBSD libtool can't find operator new[] because it is in C mode:

libtool: link: cc -fno-strict-aliasing -fopenmp -ftree-vectorize -pthread -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-strict-aliasing -fstack-protector-strong -o RNALfold RNALfold_cmdl.o RNALfold.o ../../src/ViennaRNA/.libs/libRNA_conv.a ./.libs/libhelpers.a -lm -pthread -fopenmp libtool: link: cc -fno-strict-aliasing -fopenmp -ftree-vectorize -pthread -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-strict-aliasing -fstack-protector-strong -o RNALalifold RNALalifold_cmdl.o RNALalifold.o ../../src/ViennaRNA/.libs/libRNA_conv.a ./.libs/libhelpers.a -lm -pthread -fopenmp
ld: error: undefined symbol: operator new[](unsigned long)
 >>> referenced by svm.cpp
>>>               svm.o:(Kernel::Kernel(int, svm_node* const*, svm_parameter const&)) in archive ../../src/ViennaRNA/.libs/libRNA_conv.a

I added "LT_LANG([C++]) to but it didn't help:

LT_INIT([pic-only, static])

How to switch libtool to the C++ mode?

Are you using automake?  Or just libtool and autoconf?

With automake, the info at the end of the following section in the manual might help:

I think the same idea applies to executable files, not just building libraries from a collection of convenience libraries. So (again, with automake) you can trick the system into using C++ for linking by having a C++ source file directly in the list of files to link. That C++ source file doesn't have to contain anything or even exist. Automake just notes that there is a C++ file in the list of files to link and uses the C++ linker.


reply via email to

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