Compile & Link error

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Gontran
Date:  
Subject: Compile & Link error
* Gene Holmerud () wrote:
> I'm trying to compile & link an example for mysql access from C code
> using the command:
>
> gcc -L/usr/local/mysql/lib -I/usr/local/mysql/include -o select \
> select.c -lmysql -lnsl -lsocket
>
> I get error messages:
>
> select.c: In function `main':
> select.c:5: warning: return type of `main' is not `int' <-OK
> /usr/bin/ld: cannot find -lmysql
> collect2: ld returned 1 exit status
>
> I looked in /usr/local/mysql/lib and saw *.a's, so figured I was OK
> that way. If I omit the -lmysql in the command, it doesn't object to
> the -lnsl, but fails on -lsocket. What am I missing?


believe you are looking for '-lmysqlclient' instead of '-lmysql'. I
don't believe you need a socket library linked ... sockets are part of
the glibc (to the best of my understanding). Looks ok otherwise.

hth,
Gontran