News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

link shared library to ConsoleApp

Started by grim_asle, October 17, 2013, 10:31:57 AM

Previous topic - Next topic

grim_asle

Hi there,

this is another beginners-question...
how do i link a shared library (created with code::blocks as well) to my "console-application" ?
The error i get is "cannot find -lExamplelib.so"

I have set

build_options->linker-> linked libraries->libExamplelib.so ( that is indeed the full name of the Lib)
and I have deployed the path to this lib in the "search_directories".

The same worked with static linking, and i am confused by the linker, who is searching for another name than i provided in the settings.
Is this special and can someone tell me where to find general instructions how to link a shared library to my CA ?

Thanks so far,


ps: It does work invoking the compiler from my terminal with the corresponding options.

BlueHazzard

have you set the right build target? On the left site of the build options. And it has to be activated near the build button...

grim_asle

Do you mean the "debug or release" option ?
I have checked that ... and I can't find any other options and settings etc. on the left of the Build-option pane. Maybe i'm blind ...

BlueHazzard

have you checked if on both is the same under search directories and libraries?
post the full biuild log from the build log tab

greetings

grim_asle

Hi again,

this is it:


-------------- Build: Debug in gaslite_test ---------------

Linking console executable: bin/Debug/gaslite_test
/usr/bin/ld: cannot find -llibGASLITE_BWRS.so
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings




I guess it's not much, however.

greetings

grim_asle

Hi again, i think it worked now.

I' ll check what's the reason exactly, but maybe you can tell me :
does it play a role, wether I compile the shared lib in debug mode or not ??

Because i think that was the only change I made ... between my last effort and the (successful) one now ... i'm confused ...
However, I think this is solved ... can one mark a topic as "SOLVED" in this Forum ?

... another stupid question, hee ??

BlueHazzard

for the full build log, please make a rebuild, so we can see the command lines.
Quote from: grim_asle on October 21, 2013, 08:52:27 AM
I' ll check what's the reason exactly, but maybe you can tell me :
does it play a role, wether I compile the shared lib in debug mode or not ??

well, if you set the library only in the Debug target it makes sense. In the "Build options" dialogue on the right you can choose where the buildoptions should take place, only in the debug target, only in the release or on both. So if you set the right library only in the Debug Target, you have to build the Debug target to get the right build....

here is more info:
http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks

greetings