By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,795 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,795 IT Pros & Developers. It's quick & easy.

undefined reference to ...

P: n/a
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

Jun 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 11 Jun 2006 16:43:42 -0700, "benzasu" <sb****@gmail.com> 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/~a...FAQ-acllc.html
Jun 12 '06 #2

P: n/a
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.
Jun 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.