On Wed, 3 Nov 2010, Rifat Mahmud wrote:
I installed libiconv and used '#include<iconv.h>' in a source code.
After compiling gcc prints
/tmp/ccgsye0A.o: In function `main':
/home/rifat/Documents/Sources/test1.c:12: undefined reference to `libiconv_open'
That's normal. When you want to use external functionality in a program,
you need 2 things: a #include to tell your code about the interface of
that functionality and a corresponding -l flag on the command line telling
which library to take the functionality from.
#include <math.h> ----> gcc ... -lm
#include <stdlib.h> ----> gcc ... -lc (this one is actually implicit)
#include <iconv.h> ----> gcc ... -liconv (if you are using the iconv.h
from libiconv, -lc otherwise)
How can I solve this problem. I probably didn't overwrite the system
iconv.h file, which is in /usr/local/include . I'm very much a rookie
in gcc, please help me out, Thank you.
I doubt the system iconv.h is in /usr/local.
--
Marc Glisse