User forums > Using Code::Blocks

Adding pkg_config to Code:Blocks linker

<< < (3/3)

Jenna:

--- Quote from: JulyJim on November 23, 2016, 08:49:03 pm ---Tim, you could be more helpful but I really expect way to much from forums.
Obviously situation normal - it is my fault I dare to ask here,


I have made some progress but still cannot get the pkg-config to link the libraries it finds to linker.
Just to clear things up - the question was not HOW to MAKE packages - the question was how to add them to the linker.
My GCC linker won't link if the  library string is not prefixed with ":"  so maybe pkg-config is wrong app to use,

--- End quote ---
Please copy and paste the pkg-config-line from the linker section and write exactly where you added it, please copy and paste also the "Build log" (not the "Build messages")  from a rebuild (clean and build), after saving the project, closing and reopening C::B.

BlueHazzard:

--- Quote from: JulyJim on November 23, 2016, 08:49:03 pm ---Obviously situation normal - it is my fault I dare to ask here,

--- End quote ---
Obviously it is your fault, because you have the problem ;)

So now lets give some useful comment:
NOTE: i am not a advanced user of pkg-config...

pkg-config has two important command  line options:

--- Code: ---pkg-config --cflags
--- End code ---
and

--- Code: ---pkg-config --libs
--- End code ---

--cflags will return all needed compiler flags like include paths and defines.
you have to add this command in the compiler options
Project->Build options
On the left side select your target, or your project the project name if you want to apply the option globally
then go to: compiler settings->Other compiler options. There you add the appropriate pkg-config command:

--- Code: ---`pkg-config opencv --cflags`
--- End code ---
Now we need to apply the --libs flag.  --libs will return the library paths and the libraries needed. For this go to the "linker settings" tab and under "other linker options" add

--- Code: ---`pkg-config opencv --libs`
--- End code ---
Now confirm this dialog with OK. You may have to restart codeblocks, because c::b cashes all backtick results for speed up reasons and only loads them on start up...

If you still have problems check if pkg-config opencv --cflags and pkg-config opencv --libs gives the correct results on your command line program.
If it still don't work you want future help from this forum read this and follow the steps described, especially the build log thing, because we are not able to help you with this few information you provided until now
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F


--- Quote ---OK, I have added it to linker and did not see any progress messages indicating it was used.
In theory it should not be used in compiler - it is a liker job to get the libraries.
But I'll give it a shot.
--- End quote ---
this does not add any usefull information. The build log on the other side tells us nearly all we need..

All this is no magic and can easily be found with google...

I hope this helps
greetings

Navigation

[0] Message Index

[*] Previous page

Go to full version