User forums > Using Code::Blocks

Make a program that use a .so

(1/2) > >>

clros:
Hi!

I'm making a program that would use a .so library (I previously created this library again with the code:: blocks and it contains some simple functions es. SampleFunction1() )

When I compile my program, the linker reports the error:

undefined reference to SampleFunction1 ()

Why?

(I am using code::blocks on Ubuntu/GCC)

Jenna:
Maybe because you forgot to link against the library ?

clros:

--- Quote from: jens on November 28, 2010, 08:53:56 pm ---Maybe because you forgot to link against the library ?

--- End quote ---
In "build options -> Linker settings", I entered the library name and its path (actually the .so lib is no in the /lib directory).
This is correct to link a .so library?

Jenna:

--- Quote from: clros on November 28, 2010, 09:37:26 pm ---
--- Quote from: jens on November 28, 2010, 08:53:56 pm ---Maybe because you forgot to link against the library ?

--- End quote ---
In "build options -> Linker settings", I entered the library name and its path (actually the .so lib is no in the /lib directory).
This is correct to link a .so library?

--- End quote ---

Add the path to "Build options -> Search directories -> Linker" and the library itself to "Build options -> Linker settings -> Link libraries".
Try the libraris name without leading lib and without the .so .

clros:
I get the same error  :(

Navigation

[0] Message Index

[#] Next page

Go to full version