User forums > Using Code::Blocks
Dependencies on .hpp files not triggering [SOLVED]
stahta01:
--- Quote from: MortenMacFly on July 07, 2009, 06:46:01 am ---
--- Quote from: kfmfe04 on July 07, 2009, 06:23:09 am ---MyStaticLib: libheader.hpp (no .cpp - implementation in header), other.cpp, other.hpp ...
MyApp: app.cpp (#include's libheader.hpp) ...
--- End quote ---
If app.cpp includes header.hpp of the "lib" than this works very well for me... (even if header.cpp does not have a cpp file)?!
--- End quote ---
IIRC, it makes a difference whether double quotes or square brackets are used.
I think the below should work.
--- Quote ---#include "header.hpp"
--- End quote ---
The below may not work.
--- Quote ---#include <header.hpp>
--- End quote ---
Tim S.
kfmfe04:
Hi Tim,
Your comment was very helpful. I am still having problems, but I'm getting closer to resolving it. I tried 2 things:
A -----------------------------
1. #include "libheader.hpp" in app.cpp
2. rebuild - OK, because I touched app.cpp
3. modify and save libheader.hpp
4. rebuild - BAD: doesn't recompile app.cpp
B -----------------------------
1. #include "my_full_path_to_header/libheader.hpp" in app.cpp
2. rebuild - OK, because I touched app.cpp
3. modify and save libheader.hpp
4. rebuild - OK!!! Rebuilds app.cpp
I noticed the file app.depend with a comment line # depslib dependency file v1.0
So I am wondering now, if somehow my -Imy_full_path_to_header is being passed to g++ (validated in app_build_log.html), but not being passed to depslib?
Is depslib part of C::B or a 3rd party lib?
- Ken
--- Quote ---
IIRC, it makes a difference whether double quotes or square brackets are used.
I think the below should work.
--- Quote ---#include "header.hpp"
--- End quote ---
The below may not work.
--- Quote ---#include <header.hpp>
--- End quote ---
Tim S.
--- End quote ---
kfmfe04:
With the help of your comments, I figured out the problem.
There are several places to put search directories for the compiler.
I know of:
1. Compiler and debugger settings > Global compiler settings > Search directories > Compiler
2. Project > Build Options > Search directories
---------------------------------------------------------------------
I had made the mistake of putting my library search directory in 1.
Once I removed it from 1. and put it into 2., compiles were fine.
---------------------------------------------------------------------
Doing 1. or 2. don't seem to impact the compiler, per se (maybe ordering?), but it definitely impacts depslib. Come to think of it, the design of the dependency system makes perfect sense, but it's easy to fall into this kind of gotcha when trying a new IDE.
Thanks everyone for commenting - it helps a lot to get a sanity check/idea bounces from everyone. I really appreciate it.
Regards,
Ken
(One sidenote - it doesn't seem to make a difference if I use #include <> or #include "" - in the old C-days, #include "" used to mean don't use the -Ipaths to look for headers, but this doesn't seem to apply any more... ...I can't seem to find a difference between the two for C++)
Navigation
[0] Message Index
[*] Previous page
Go to full version