Thursday 25 October 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...