User forums > Using Code::Blocks
Linking Nested Dependent Libraries/Sources [SOLVED]
Guy:
Hello everyone. First and foremost, let me say that I'm fairly new to Code::Blocks and to C/C++ programming in general. This is probably a noob question.
I'm on Linux trying to use cb 12.11 to compile a C++ program that's available open source, just to get my feet wet with a large project (I've done small standalone projects in the past). This program uses multiple external static linked libraries. Now, every time I try to compile the program the compiler complains it can't find a header file for an external library. So, I track down the header file on my system, put the path in the 'Search Directories' section of my Build Options window and try compilation again. But then that dependency has another dependency that defines another header file and I have to enter that one into the 'Search Directories' section again. This process continues over and over again ad nauseum. I suppose I could end up spending a week compiling, tracing and entering file paths into the build options, but I'm hoping there's a better way. Like I said, I'm new to this so hopefully there's something I'm missing.
--- Code: ---Example (not real but the jist of what I'm experiencing):
(Compile)
source.cpp has [i]#include <gtk/gtk.h>[/i]
Compile error: can't find gtk.h -> locate gtk.h -> put /usr/include/gtk-2.0/ into 'Search Directories'
(Compile)
gtk.h has [i]#include <gio/gio.h>[/i]
Compile error: can't find gio.h -> locate gio.h -> put /usr/include/glib-2.0/ into 'Search Directories'
(Compile)
gio.h has [i]#include <glibconfig.h>[/i]
Compile error: can't find glibconfig.h -> locate glibconfig.h -> put /usr/include/glib-2.0/include/ into 'Search Directories'
etc....
--- End code ---
Note, these are all dependent but "standard" libraries. Also, I've already made sure /usr/include/ is in the Search Directories. I've seen posts on this forum that say recursive linking is bad and I can understand why but there's just got to be a better way to tell cb (and the compiler/linker for that matter) where all these nested dependent libraries are. Can anyone tell me how to properly set up my project so it finds these libraries on its own? Thanks for reading my long post.
stahta01:
Read these three FAQs and re-read the rules.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_What_do_I_need_to_know_when_using_3rd_party_libs.3F
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
http://forums.codeblocks.org/index.php/topic,9996.0.html
stahta01:
Another thing to check is Global Compiler Settings for the Compiler being used by the CB Project.
(This has fixed errors similar to yours in the past for me.)
Settings -> Compiler
Select your Compiler
"Global Compiler Settings"
Tab "Build Options" Scroll to right if not visible.
Checkmark "Explicitly add Currently compiling file directory"
Tim S.
Guy:
Thank you for such a quick reply stahta01! I checked out those resources, as well as a few others in the FAQ and the Wiki, searched the forums and the web, and finally posted my question here. I read the rules too and found:
--- Quote ---There's the "Using CodeBlocks" board to help newbies set up their compilers and change their configuration.
--- End quote ---
I believe I'm dealing with a cb configuration issue, nothing more, which is why I posted my question to this forum.
I took your suggestion and re-read those entries and have come to the conclusion that I need to actually just sit down and enter every dang path to every dang header file on my system in the "Global Compiler Settings" -> Search Directories tab. What a chore, but oh well, I still really like this IDE. I tried checking that tick box you mentioned but it doesn't help for dependency libraries, at least in my case.
Thanks again for your suggestions!
stahta01:
Did you try the normal Linux way?
Using the Linux script command that returns the information; CB Supports that remember to use back ticks.
Tim S.
Navigation
[0] Message Index
[#] Next page
Go to full version