undefined reference to "..."
Hello:
I execute make ,then get error:
$ make
Making all in libsbml/src
make[1]: Entering directory `/home/internet/mydoc/test_pj/libsbml/src'
........
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o test test.o
libsbml/src/libsbml.la -lsbml -lstdc++ -lm
mkdir .libs
gcc -g -O2 -o .libs/test test.o libsbml/src/.libs/libsbml.so -lstdc++
-lm -Wl,--rpath -Wl,/usr/local/lib
libsbml/src/.libs/libsbml.so: undefined reference to `safe_strdup'
libsbml/src/.libs/libsbml.so: undefined reference to
`util_bsearchStringsI'
libsbml/src/.libs/libsbml.so: undefined reference to `safe_malloc'
libsbml/src/.libs/libsbml.so: undefined reference to `util_PosInf'
libsbml/src/.libs/libsbml.so: undefined reference to `util_isInf'
libsbml/src/.libs/libsbml.so: undefined reference to `util_NaN'
libsbml/src/.libs/libsbml.so: undefined reference to `safe_calloc'
libsbml/src/.libs/libsbml.so: undefined reference to
`strcmp_insensitive'
libsbml/src/.libs/libsbml.so: undefined reference to `c_locale_strtod'
Why system can not find these function ,they are system file
<stdlib.h> <new> <cmath>
which has been included in my app.c.
What should I do?
Eager to receive your reply!
my configure.in file:
AC_INIT(main, 0.1, zqiang...@gmail.com)
AM_INIT_AUTOMAKE(foreign)
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_OUTPUT(Makefile libsbml/src/Makefile)
my Makefile.am file:
bin_PROGRAMS = test
SUBDIRS = libsbml/src .
test_SOURCES = test.c
test_LDADD = libsbml/src/libsbml.la -lsbml -lstdc++ -lm
AM_CPPFLAGS = -Ilibsbml/include
my libsbml/src/Makefile.am
AUTOMAKE_OPTS = gnu
lib_LTLIBRARIES = libsbml.la
libsbml_la_SOURCES = common/libsbml-version.cpp math/ASTNode.cpp math/
FormulaTokenizer.c util/List.cpp
AM_CPPFLAGS = -I../include -lsbml -lstdc++ -lm
Re: undefined reference to "..."
zqiang320 wrote:[color=blue]
> Hello:
>
> I execute make ,then get error:
>[/color]
Same answer as before (that's 4 times now).
--
Ian Collins.
Re: undefined reference to "..."
Ian Collins wrote:[color=blue]
> zqiang320 wrote:[color=green]
>> Hello:
>>
>> I execute make ,then get error:
>>[/color]
> Same answer as before (that's 4 times now).
>[/color]
Oops, sorry I thought I was reading another group!
--
Ian Collins.
Re: undefined reference to "..."
zqiang320 wrote:[color=blue]
> Hello:
>
> I execute make ,then get error:
>
> $ make
> Making all in libsbml/src
> make[1]: Entering directory `/home/internet/mydoc/test_pj/libsbml/src'
> ........
> /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o test test.o
> libsbml/src/libsbml.la -lsbml -lstdc++ -lm
> mkdir .libs
> gcc -g -O2 -o .libs/test test.o libsbml/src/.libs/libsbml.so -lstdc++
> -lm -Wl,--rpath -Wl,/usr/local/lib[/color]
You should probably be compiling with g++, not gcc, assuming you are
building a C++ application.
[color=blue]
>
> Why system can not find these function ,they are system file
> <stdlib.h> <new> <cmath>
> which has been included in my app.c.[/color]
The functions aren't in the headers, they are just declared there.
Using .c as the extension for a C++ file might be confusing your tools.
--
Ian Collins.
Re: undefined reference to "..."
On 9月27日, 下午3时26分, Ian Collins <ian-n...@hotmail.com> wrote:[color=blue]
> zqiang320 wrote:[color=green]
> > Hello:[/color]
> ....[color=green]
> > Why system can not find these function ,they are system file
> > <stdlib.h> <new> <cmath>
> > which has been included in my app.c.[/color]
>
> The functions aren't in the headers, they are just declared there.
> Using .c as the extension for a C++ file might be confusing your tools.
>[/color]
I have modify Makefile.am
bin_PROGRAMS = test
test_SOURCES = test.cpp
But I still got error message:
$ make
Making all in libsbml/src
............
Making all in .
make[1]: Entering directory `/home/internet/mydoc/test_pj'
make[1]: *** No rule to make target `test.c', needed by `test.o'.
Stop.
make[1]: Leaving directory `/home/internet/mydoc/test_pj'
What shall I do thank you very much!
ps: test.c has been changed to test.cpp
[color=blue]
> --
> Ian Collins.[/color]
Re: undefined reference to "..."
zqiang320 wrote:[color=blue]
> On 9月27日, 下午3时26分, Ian Collins <ian-n...@hotmail.com> wrote:[color=green]
>> zqiang320 wrote:[color=darkred]
>>> Hello:[/color]
>> ....[color=darkred]
>>> Why system can not find these function ,they are system file
>>> <stdlib.h> <new> <cmath>
>>> which has been included in my app.c.[/color]
>> The functions aren't in the headers, they are just declared there.
>> Using .c as the extension for a C++ file might be confusing your tools.
>>[/color]
> I have modify Makefile.am
> bin_PROGRAMS = test
>
> test_SOURCES = test.cpp
>
> But I still got error message:
>
> $ make
> Making all in libsbml/src
> ............
> Making all in .
> make[1]: Entering directory `/home/internet/mydoc/test_pj'
> make[1]: *** No rule to make target `test.c', needed by `test.o'.
> Stop.
> make[1]: Leaving directory `/home/internet/mydoc/test_pj'[/color]
Do you have an explicit rule for test.o in your makefile?
--
Ian Collins.
Re: undefined reference to "..."
On 9月27日, 下午4时16分, Ian Collins <ian-n...@hotmail.com> wrote:
....[color=blue]
>
> Do you have an explicit rule for test.o in your makefile?
>
> --
> Ian Collins.[/color]
below is my program,please help me check it? thank you very much!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sbml/math/ASTNode.h> /* definition of ABS */
/*
*--------------------------------------------------------------------
* MAIN PROGRAM
*--------------------------------------------------------------------
*/
int main(int argc, char *argv[])
{
ASTNode_t *copy;
copy=ASTNode_create();
int nodeout=ASTNode_isBoolean(copy);
printf("nodeout = %5ld\n\n", nodeout);
return(0);
}
Re: undefined reference to "..."
On 9月27日, 下午4时16分, Ian Collins <ian-n...@hotmail.com> wrote:[color=blue]
> zqiang320 wrote:[color=green]
> > On 9月27日, 下午3时26分, Ian Collins <ian-n...@hotmail.com> wrote:[color=darkred]
> >> zqiang320 wrote:
> >>> Hello:
> >> ....
> >>> Why system can not find these function ,they are system file
> >>> <stdlib.h> <new> <cmath>
> >>> which has been included in my app.c.
> >> The functions aren't in the headers, they are just declared there.
> >> Using .c as the extension for a C++ file might be confusing your tools..[/color][/color]
>[color=green]
> > I have modify Makefile.am
> > bin_PROGRAMS = test[/color]
>[color=green]
> > test_SOURCES = test.cpp[/color]
>[color=green]
> > But I still got error message:[/color]
>[color=green]
> > $ make
> > Making all in libsbml/src
> > ............
> > Making all in .
> > make[1]: Entering directory `/home/internet/mydoc/test_pj'
> > make[1]: *** No rule to make target `test.c', needed by `test.o'.
> > Stop.
> > make[1]: Leaving directory `/home/internet/mydoc/test_pj'[/color]
>
> Do you have an explicit rule for test.o in your makefile?
>
> --
> Ian Collins.[/color]
It is my mistake ,I did not include the function file in my test.cpp,
Thank you very much!