undefined reference to "..." - Unix

This is a discussion on undefined reference to "..." - Unix ; 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 ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: undefined reference to "..."

  1. 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

    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

  2. Re: undefined reference to "..."

    zqiang320 wrote:
    > Hello:
    >
    > I execute make ,then get error:
    >

    Same answer as before (that's 4 times now).

    --
    Ian Collins.

  3. Re: undefined reference to "..."

    Ian Collins wrote:
    > zqiang320 wrote:
    >> Hello:
    >>
    >> I execute make ,then get error:
    >>

    > Same answer as before (that's 4 times now).
    >

    Oops, sorry I thought I was reading another group!

    --
    Ian Collins.

  4. Re: undefined reference to "..."

    zqiang320 wrote:
    > 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


    You should probably be compiling with g++, not gcc, assuming you are
    building a C++ application.

    >
    > Why system can not find these function ,they are system file
    >
    > 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.

    --
    Ian Collins.

  5. Re: undefined reference to "..."

    On 9月27日, 下午3时26分, Ian Collins wrote:
    > zqiang320 wrote:
    > > Hello:

    > ....
    > > Why system can not find these function ,they are system file
    > >
    > > 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.
    >

    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

    > --
    > Ian Collins.



  6. Re: undefined reference to "..."

    zqiang320 wrote:
    > On 9月27日, 下午3时26分, Ian Collins wrote:
    >> zqiang320 wrote:
    >>> Hello:

    >> ....
    >>> Why system can not find these function ,they are system file
    >>>
    >>> 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.
    >>

    > 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'


    Do you have an explicit rule for test.o in your makefile?

    --
    Ian Collins.

  7. Re: undefined reference to "..."

    On 9月27日, 下午4时16分, Ian Collins wrote:
    ....
    >
    > Do you have an explicit rule for test.o in your makefile?
    >
    > --
    > Ian Collins.

    below is my program,please help me check it? thank you very much!

    #include
    #include
    #include

    #include /* 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);
    }

  8. Re: undefined reference to "..."

    On 9月27日, 下午4时16分, Ian Collins wrote:
    > zqiang320 wrote:
    > > On 9月27日, 下午3时26分, Ian Collins wrote:
    > >> zqiang320 wrote:
    > >>> Hello:
    > >> ....
    > >>> Why system can not find these function ,they are system file
    > >>>
    > >>> 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..

    >
    > > 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'

    >
    > Do you have an explicit rule for test.o in your makefile?
    >
    > --
    > Ian Collins.


    It is my mistake ,I did not include the function file in my test.cpp,

    Thank you very much!

+ Reply to Thread