Thursday, October 25, 2018

linker - CodeBlocks External Library Management



I'm having some trouble installing libraries for use in Code::Blocks. Specifically, the opencv library. I would like to be able to store all of my libraries in a single file, and also be able to to include a header file from the library in any program by stating



#include "header.h"



rather than the much longer



#include "C:\ Programs \ bla \ bla \ bla \ Libraries \ mylib \ lib \ header.h"


Is this possible, or do I have to include a copy of the library in each of the programs that I want to use it in?



How should I configure my compiler and linker search directories to achieve this? How should I configure my linker settings?


Answer



You should be able to, if all your header files are in one directory, include the directory in the global settings. Every project will then look there for the file.





code::blocks -> settings -> compiler settings -> global compiler settings -> compiler settings tab -> other options tab -> write "-I the/string/to/ your/directories" and -> OK




this makes all projects link to this directory. If you place your headers there, you should be good to go



KR



Hewi



No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...