undefined reference to ...

Discussion in 'C Programming' started by benzasu, Jun 12, 2006.

  1. benzasu

    benzasu Guest

    Hi i am trying to compile a set of programs but i receive the following
    error with try to make the time running program, i write my program in
    C and try to call a C++ function of a library building in and
    compilated succesfully in C++,

    the funtion (in C++) is:
    #include "header.h"
    .....
    extern "C" int llamada(int det,pgmd* ventana) { ... }
    ......

    with a header :
    #ifdef __cplusplus
    extern "C"
    #endif
    int llamada(int det, pgmd* ventana);

    and the calling in C is:
    #include "header.h"
    .....
    det = llamada(ii, &ventana);
    .....

    The result of compilation is:

    server@user:~/Gideo-0TRY/src$ gcc -Wall -g -lcrypt -o gideo support.o
    main.o interface.o callbacks.o avilib.o spcadecoder.o spcav4l.o utils.o
    -Wl,--export-dynamic -L/usr/local/lib -L/usr/X11R6/lib
    /usr/lib/libgnomeui-2.so -L/usr/lib /usr/lib/libgnome-keyring.so
    /usr/lib/libbonoboui-2.so -lSM -lICE /usr/lib/libgnomecanvas-2.so
    /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so
    /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libgnome-2.so /usr/lib/libesd.so
    /usr/lib/libaudiofile.so /usr/lib/libart_lgpl_2.so
    /usr/lib/libpangoft2-1.0.so /usr/lib/libgnomevfs-2.so
    /usr/lib/libxml2.so /usr/lib/libgnutls.so /usr/lib/libtasn1.so
    /usr/lib/libgcrypt.so -lnsl /usr/lib/libgpg-error.so -lresolv -lrt
    /usr/lib/libbonobo-2.so /usr/lib/libgconf-2.so
    /usr/lib/libbonobo-activation.so /usr/lib/libORBitCosNaming-2.so
    /usr/lib/libORBit-2.so /usr/lib/libpopt.so /usr/lib/libgthread-2.0.so
    /usr/local/lib/libgtk-x11-2.0.so /usr/local/lib/libgdk-x11-2.0.so
    /usr/lib/libatk-1.0.so /usr/local/lib/libgdk_pixbuf-2.0.so
    /usr/lib/libpangoxft-1.0.so /usr/lib/libpangox-1.0.so
    /usr/lib/libpango-1.0.so /usr/lib/libgobject-2.0.so
    /usr/lib/libgmodule-2.0.so /usr/lib/libglib-2.0.so -laudio -lXt -lX11
    -lXext /usr/lib/libaa.so -lncurses -lslang /usr/lib/libasound.so -ldl
    -lm /usr/lib/libSDL_image.so -ltiff /usr/lib/libjpeg.so -lpng -lz
    /usr/lib/libSDL.so -lpthread -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
    -Wl,/usr/local/lib
    /usr/bin/ld: warning: libtiff.so.4, needed by /usr/lib/libSDL_image.so,
    may conflict with libtiff.so.3
    main.o(.text+0x1660): In function `processvideo':
    /home/user/Gideo-0TRY/src/main.c:640: undefined reference to `llamada'
    collect2: ld returned 1 exit status

    Thank you for your colaboration

    benzasu
     
    benzasu, Jun 12, 2006
    #1
    1. Advertising

  2. benzasu

    Jack Klein Guest

    On 11 Jun 2006 16:43:42 -0700, "benzasu" <> wrote in
    comp.lang.c:

    > Hi i am trying to compile a set of programs but i receive the following
    > error with try to make the time running program, i write my program in
    > C and try to call a C++ function of a library building in and
    > compilated succesfully in C++,


    Pretty much anything to do with C++ is off-topic in this group. C,
    which came first, does not define an interface to any other language,
    and that includes C++. So this is not a C language issue.

    Even if your C and C++ compilers provide a method of doing this, it is
    100% compiler specific. Undefined references are generated by the
    linker, and neither language defines the operation of such tools.

    I would suggest you ask this question in
    news:comp.os.linux.development.apps

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Jun 12, 2006
    #2
    1. Advertising

  3. benzasu

    Ian Collins Guest

    benzasu wrote:
    > Hi i am trying to compile a set of programs but i receive the following
    > error with try to make the time running program, i write my program in
    > C and try to call a C++ function of a library building in and
    > compilated succesfully in C++,
    >
    > the funtion (in C++) is:
    > #include "header.h"
    > .....
    > extern "C" int llamada(int det,pgmd* ventana) { ... }
    > ......
    >
    > with a header :
    > #ifdef __cplusplus
    > extern "C"
    > #endif
    > int llamada(int det, pgmd* ventana);
    >

    You probably want

    #ifdef __cplusplus
    extern "C" {
    #endif

    int llamada(int det, pgmd* ventana);

    #ifdef __cplusplus
    }
    #endif

    --
    Ian Collins.
     
    Ian Collins, Jun 12, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Felipe
    Replies:
    3
    Views:
    446
    Felipe
    Jul 16, 2004
  2. Lu
    Replies:
    1
    Views:
    578
    Roel Schroeven
    Jul 10, 2003
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,763
    Dan Pop
    Feb 17, 2004
  4. VK
    Replies:
    45
    Views:
    605
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    373
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page