User forums > Using Code::Blocks
adding library files and getting function declaration
Jenna:
--- Quote from: jens on February 02, 2009, 03:26:15 pm ---
--- Code: ---`pkg-config --libs libraryname`
--- End code ---
can be used if pkg-config and an appropriate config-file exists.
Just place it including the backticks in your projects build options, tab "Linker settings -> Other linker options".
--- Code: ---`pkg-config --cflags libraryname`
--- End code ---
can be used for includes and compile-flags in "Compiler settings -> Other options".
The backticks work on windows also (only in C::B).
You can, of course, call any other external program or script also and the call within the backticks will be replaced by the output.
--- End quote ---
Did you follow my steps ?
The first one is important.
C::B normally divides compiling and linking in two steps.
Compiling needs the --cflags-parameter for pkg-config, linking needs --libs.
lehe:
Hi Jens,
Your steps work fine! It's just that, compared to gcc in terminal, I have to do some extra things, besides "`pkg-config --cflags --libs opencv` `pkg-config --cflags --libs gtk+-2.0`", to build my program in CB : install gtk1.2 and link my program to libdl.a. Although not clear about why, I've fixed this kind of problem.
The other problem, which have been bothered me since I first used CB along with 8.02, 5382 and 5432, is: getting the declaration of functions or variables in CB sometimes work sometimes not.
(1) For library functions, even if I set correctly the directories of header files and library files and what the library files that my code should be linked to and build my program successfully, I still can't get the declaration for its functions or jump to its header files in CB, neither can I for some functions of standard C/C++ library, like exit(), printf(). But I can get declarations from string or math libraries, like for strcpy() and log().
(2) For self-written functions or variables, I can jump to their declarations, but I cannot get them simply by placing mouse on them.
(3) The mouse can get declaration for A when it is defined by "#define A B", but the declaration I get is "AA B" (two A's in a row), something messed up.
If someone knows any clue, it will help me a lot.
Thank you!
Update:
I searched the forum a little bit. The declaration problem is not unusual. I tried two suggestions posted: in search directory add the one for header files, and reparse the symbols. But they don't solve the problem. Are you guys not bothered by this problem? How do you get around it? Thanks!
Navigation
[0] Message Index
[*] Previous page
Go to full version