Author Topic: Adding libraries to project (maybe am i missing something?)  (Read 851 times)

Offline isendrak

  • Single posting newcomer
  • *
  • Posts: 4
    • drakensmitta.ml
Adding libraries to project (maybe am i missing something?)
« on: April 22, 2017, 03:55:47 pm »
Ahoy everyone,
i'm currently having a "little" problem, regarding the process of adding a 3rd party library to my project (openssl, if that's relevant):
In "Project options"->"Libraries"->"Libraries used in project" i added "openssl (pkg-config)", but for some reason Code::Blocks seems to totally ignore this.
Normally there should be "-lssl -lcrypto" in the linker's command, but it's not there...
So the question is: Am i missing something, or is this a bug/error/foo?

P.S.: In case it's relevant: I'm using Code::Blocks version 13.12 rev 9501 on Ubuntu 16.04.2 LTS.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7222
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Adding libraries to project (maybe am i missing something?)
« Reply #1 on: April 22, 2017, 04:22:36 pm »
13.12 is really old, but that should not matter in this case.
What exactly do you add ?

It should be something like:
Code: [Select]
`pkg-config foo --cflags`or
Code: [Select]
`pkg-config foo --libs`or in other words, the exact "pkg-config"-command in backticks.
In "Compiler settings -> Other compiler options" for the compiler-stuff and in "Linker settings -> Other linker options" for the linktime related command.
Either on target or on project-level of the build options.

Offline isendrak

  • Single posting newcomer
  • *
  • Posts: 4
    • drakensmitta.ml
Re: Adding libraries to project (maybe am i missing something?)
« Reply #2 on: April 22, 2017, 05:03:51 pm »
Okay, adding the pkg-config stuff works.  :)

But then, what exactly is the purpose of the "Project options"->"Libraries"->"Libraries used in project" list?  ???

This one:


P.S.: It doesn't make any difference, whether openssl is listed there or not...

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7222
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Adding libraries to project (maybe am i missing something?)
« Reply #3 on: April 22, 2017, 05:11:21 pm »
Depends on what you add there.
If you just need "-lssl" and "-lcrypto" as linker-command, you should add "ssl" and "crypto" there.

Offline isendrak

  • Single posting newcomer
  • *
  • Posts: 4
    • drakensmitta.ml
Re: Adding libraries to project (maybe am i missing something?)
« Reply #4 on: April 22, 2017, 05:49:43 pm »
That's in the "Build options"...
The "thing" i was asking about is in the window you get, when you "right-click" the project, select "Properties...", on the tab labelled "Libraries"...

P.S.: It definitly IS working by adding the pkg-config commands in the "Build options", but i still don't understand, what the purpose of the "Libraries used in project" list is, since it seems to have no effect at all...

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7222
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Adding libraries to project (maybe am i missing something?)
« Reply #5 on: April 22, 2017, 05:57:06 pm »
That's in the "Build options"...
The "thing" i was asking about is in the window you get, when you "right-click" the project, select "Properties...", on the tab labelled "Libraries"...

P.S.: It definitly IS working by adding the pkg-config commands in the "Build options", but i still don't understand, what the purpose of the "Libraries used in project" list is, since it seems to have no effect at all...
Now I understand.
I never use it.
Did you uncheck the "Don't set up automatically" ?
If I do this it works as expected on my system.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7222
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Adding libraries to project (maybe am i missing something?)
« Reply #6 on: April 22, 2017, 06:00:06 pm »
By the way:
the "Libraries"-tab in the properties belongs to the "lib-finder"-plugin.

Offline isendrak

  • Single posting newcomer
  • *
  • Posts: 4
    • drakensmitta.ml
Re: Adding libraries to project (maybe am i missing something?)
« Reply #7 on: April 23, 2017, 03:57:56 am »
Quote
Did you uncheck the "Don't set up automatically" ?
Now i did, now it works... Dunno, what exactly "Don't set up automatically" means in this context though...  :o

Quote
the "Libraries"-tab in the properties belongs to the "lib-finder"-plugin.
This, i excepted somewhat... The "lib-finder" plugin was mentioned in the dialog you get, when clicking on "Try to detect missing ones"... ;D

P.S.: YAY! It worketh, me thanketh thee for thine help and wisheth thee a good night/day (depending on thine zone o' time...)

P.P.S.: How exactly doth one mark a topic o' oneself as solved here?