[C] Linker Error

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[C] Linker Error

"Severin Müller"
Hi folks

I tried to include sqlite3 in my current C Project.

I downloaded the precompiled library sqlite-3.5.6.so and put it in my project.
Then, i downloaded the sqlite source and added sqlite3.h to my project.

Now, when i try to compiler, i get the following error message:

/home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlsym'
/home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlerror'
/home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlopen'
/home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlclose'

I'm using the Ecplipse IDE with GCC on Linux.

Does anyone know what i'm doing wrong? I noticed, that there is no *.a file coming along with the precompiled library, Intentionally?

Many thanks in advance for your quick help!

Kind regards

Severin
--
Severin A. Mueller
Mythenquai 2
CH-8022 Zurich
Office: +41 44 278 85 03
Mobile: +41 76 249 85 38


Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [C] Linker Error

Clay Dowling
Severin Müller wrote:

> I tried to include sqlite3 in my current C Project.
>
> I downloaded the precompiled library sqlite-3.5.6.so and put it in my project.
> Then, i downloaded the sqlite source and added sqlite3.h to my project.
>
> Now, when i try to compiler, i get the following error message:
>
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlsym'
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlerror'
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlopen'
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlclose'

Rather than use the precompiled library, I recommend one of two options:

1. Download the latest version that is in your package manager and use
that, if it is sufficiently recent.

2. Download the source and build it.  It is a very easy to build
package, and you would then have the option to build a static version if
you wanted (the .a library)

Clay
--
CeaMuS, Simple Content Management
http://www.ceamus.com
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [C] Linker Error

D. Richard Hipp
Clay Dowling <[hidden email]> wrote:

> Severin Müller wrote:
> > I tried to include sqlite3 in my current C Project. =
>
> > =
>
> > I downloaded the precompiled library sqlite-3.5.6.so and put it in my pro=
> ject.
> > Then, i downloaded the sqlite source and added sqlite3.h to my project. =
>
> > =
>
> > Now, when i try to compiler, i get the following error message:
> > =
>
> > /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference =
> to `dlsym'
> > /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference =
> to `dlerror'
> > /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference =
> to `dlopen'
> > /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference =
> to `dlclose'
>
> Rather than use the precompiled library, I recommend one of two options:
>
> 1. Download the latest version that is in your package manager and use
>    that, if it is sufficiently recent.
>
> 2. Download the source and build it.  It is a very easy to build
>    package, and you would then have the option to build a static version if
>    you wanted (the .a library)
>
I agree with Clay.  Get a copy of the amalagamation.  It is a single
file of C code named sqlite3.c.  Compile it and statically link it
with your application.

But even then, you're going to get the same linker errors because you
have omitted the "-ldl" option when you link.

--
D. Richard Hipp <[hidden email]>


_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [C] Linker Error

John Stanton-3
In reply to this post by "Severin Müller"
Looks like you need to include the shared library archive into your LIB
list.

Severin Müller wrote:

> Hi folks
>
> I tried to include sqlite3 in my current C Project.
>
> I downloaded the precompiled library sqlite-3.5.6.so and put it in my project.
> Then, i downloaded the sqlite source and added sqlite3.h to my project.
>
> Now, when i try to compiler, i get the following error message:
>
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlsym'
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlerror'
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlopen'
> /home/fish-guts/workspace/Debug/lib/sqlite-3.5.6.so: undefined reference to `dlclose'
>
> I'm using the Ecplipse IDE with GCC on Linux.
>
> Does anyone know what i'm doing wrong? I noticed, that there is no *.a file coming along with the precompiled library, Intentionally?
>
> Many thanks in advance for your quick help!
>
> Kind regards
>
> Severin

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [C] Linker Error

"Severin Müller"
In reply to this post by "Severin Müller"
Hi Folks

Thanks for your answers.

I already had the latest build, and i linked the lib correctly with my Linker.

I found the solution in the meantime. It was quite easy actually:

I only had to manually add the -ldl option to my linker and all worked fine.

Thanks anyway for your support :)

Kind regards

Severin
--
Severin A. Mueller
Mythenquai 2
CH-8022 Zurich
Office: +41 44 278 85 03
Mobile: +41 76 249 85 38


GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users