Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > linking question

Reply
Thread Tools

linking question

 
 
mdrons@yahoo.com
Guest
Posts: n/a
 
      03-17-2006
I am trying to create a library and I am getting a linking error.

I have a library mylib.so. mylib.so uses mysqlclient. When I compile
my .o files and then try to link them using mylib.so, i get an error
saying that mysql_init (part of mysqlclient) is unknown.

Any help on what I am missing?

Mike

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      03-18-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I am trying to create a library and I am getting a linking error.
>
> I have a library mylib.so. mylib.so uses mysqlclient. When I compile
> my .o files and then try to link them using mylib.so, i get an error
> saying that mysql_init (part of mysqlclient) is unknown.
>
> Any help on what I am missing?
>

OT here, try comp.unix.programmer.

Hint - you have to specify all object files and libraries to the linker.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
NUPUL
Guest
Posts: n/a
 
      03-18-2006
hey mike...i maybe able to help....

i faced the same problem at one time...an error too trivial but yet
over looked...
on the prompt when you compile your file there a re a few libs you need
to include, which you may not be doing, i.e

$>gcc... -lmysqlclient

or

$>gcc... -llibmysqlclient

hope it works...

 
Reply With Quote
 
John Tsiombikas (Nuclear / Mindlapse)
Guest
Posts: n/a
 
      03-18-2006
On 2006-03-18, NUPUL <(E-Mail Removed)> wrote:
> i faced the same problem at one time...an error too trivial but yet
> over looked...


What problem? Please include context, and proper attribution when you
reply to an article, so that we may know what are you talking about, and
who are you talking to.

> on the prompt when you compile your file there a re a few libs you need
> to include, which you may not be doing, i.e


<OT>
Or even better yet, write a makefile so you don't forget things easily.

> $>gcc... -lmysqlclient


correct.

> $>gcc... -llibmysqlclient


incorrect, the lib prefix is implied, a different way might be:
gcc .... $(libdir)/libmysqlclient.a
given that there is a static library available, note: no -l
</OP>

How do you know the OP is using GCC ? Unless I missed it, he didn't
specify. And even if he did, how to use a specific compiler is not on
topic in comp.lang.c.

What you *could* answer in order to be on topic, and not assume anything
about the OP's tools is that: the OP has probably forgot to link the
library he mentioned, and he should read the documentation of his C
implementation to find out how to do that.

--
John Tsiombikas (Nuclear / Mindlapse)
(E-Mail Removed)
http://nuclear.demoscene.gr/
 
Reply With Quote
 
NUPUL
Guest
Posts: n/a
 
      03-20-2006
hey john,

i apologise for the myriad discrepancies you pointed out in the reply.

john wrote:
>How do you know the OP is using GCC ? Unless I missed it, he didn't
>specify.


i presumed 'gcc' on the pretext that mike wanted to link a '.so' file,
right? so i presumed the presence of gcc.........my apologies to you if
my presumptions hurted your feelings

>And even if he did, how to use a specific compiler is not on
>topic in comp.lang.c.


I am fully aware that this is a comp.lang.c group and i presume that a
compiler is a must!!

Sorry if my presumptions gave you a restless time....i'll take care of
next time..

Thanks for pointing it out.

Nupul

 
Reply With Quote
 
Vladimir S. Oka
Guest
Posts: n/a
 
      03-20-2006
NUPUL opined:
> john wrote:
>>
>>And even if he did, how to use a specific compiler is not on
>>topic in comp.lang.c.

>
> I am fully aware that this is a comp.lang.c group and i presume that
> a compiler is a must!!


Still off-topic, as c.l.c discusses C language, not tools.

--
BR, Vladimir

We are not loved by our friends for what we are;
rather, we are loved in spite of what we are.
-- Victor Hugo

 
Reply With Quote
 
NUPUL
Guest
Posts: n/a
 
      03-20-2006
vladimir, i had just highlighted a syntax and wasn't keen on discussing
the tool per se.

 
Reply With Quote
 
Vladimir S. Oka
Guest
Posts: n/a
 
      03-20-2006
NUPUL opined:

> vladimir, i had just highlighted a syntax and wasn't keen on
> discussing the tool per se.


Quote context (you were already told this). Read:

<http://cfaj.freeshell.org/google/>
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

You were not discussing *C* syntax. You offered a couple of compiler
invocation lines. How is that not discussing the tool, per se or not,
is beyond me.

--
BR, Vladimir

A young lad named Lester McGraw
Caught a stranger on top of his Maw.
As he watched him stick her
He said, with a snicker,
"You do it much faster than Paw."

 
Reply With Quote
 
NUPUL
Guest
Posts: n/a
 
      03-21-2006
my apologies vladimir, i'll take care next time not to hurt the
chauvinism of the group members of c.l.c and be confined to *C* in my
discussion.

 
Reply With Quote
 
Vladimir S. Oka
Guest
Posts: n/a
 
      03-21-2006
NUPUL opined:

> my apologies vladimir, i'll take care next time not to hurt the
> chauvinism of the group members of c.l.c and be confined to *C* in my
> discussion.


You have been asked, nicely, to quote context twice before. You still
fail to. Now, you also call people names, and try to be facetious.

Being a c.l.c chauvinist, feelings hurt beyond repair, I must say this:

*PLONK*

--
BR, Vladimir

There are always alternatives.
-- Spock, "The Galileo Seven", stardate 2822.3

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question regarding linking and moving - any advice greatly appreciated Kirok Java 2 11-10-2005 02:39 PM
Control linking question ???? =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?= ASP .Net 2 11-01-2005 06:51 PM
Linking question Hugo de Payns HTML 1 06-23-2005 06:31 AM
Newby Question Linking of data between HTML and ASP! John Baker ASP .Net 3 02-08-2005 01:13 PM
Stylesheet linking question Dylan Parry HTML 6 11-15-2004 07:53 PM



Advertisments