简体   繁体   中英

math.h not being included even when it is included in makefile

I am trying to build SPRO from http://www.irisa.fr/metiss/guig/spro

They use to generate the makefile. 生成makefile。

My issue is that when I am trying to make the project I am getting the error

"undefined reference to 'sin' " etc.

Here is the error image

在此输入图像描述

This error is due to the fact that math library is not being included with -lm flag but -lm is present in makefile.am

Here is my makefile.am

AUTOMAKE_OPTIONS = 1.4 foreign

ACLOCAL_AMFLAGS = -I auxdir

LDADD    = -lm -L. -lspro @sphere_lib@
INCLUDES = @sphere_include@

include_HEADERS = spro.h
lib_LIBRARIES = libspro.a
noinst_HEADERS = getopt.h

libspro_a_SOURCES = system.h spro.h sig.c spf.c header.c misc.c lpc.c   convert.c fft.c

bin_PROGRAMS = scopy slpc slpcep sfbank sfbcep
noinst_PROGRAMS = scompare

scopy_SOURCES = scopy.c getopt.c getopt1.c
scopy_DEPENDENCIES = libspro.a

slpc_SOURCES = slpc.c getopt.c getopt1.c
slpc_DEPENDENCIES = libspro.a

slpcep_SOURCES = slpcep.c getopt.c getopt1.c
slpcep_DEPENDENCIES = libspro.a

sfbank_SOURCES = sfbank.c getopt.c getopt1.c
sfbank_DEPENDENCIES = libspro.a

sfbcep_SOURCES = sfbcep.c getopt.c getopt1.c
sfbcep_DEPENDENCIES = libspro.a

scompare_SOURCES = scompare.c getopt.c getopt1.c
scompare_DEPENDENCIES = libspro.a

SUBDIRS = doc auxdir test
EXTRA_DIST = README INSTALL COPYING CHANGES

Can anyone guide me how to fix this issue?

Change the order of the dependencies (if libA needs symbols from libB then the order should be -lA -lB ). So it should be:

LDADD    = -L. -lspro @sphere_lib@ -lm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM