List Info

Thread: Header files not added to Makefile




Header files not added to Makefile
user name
2006-09-22 12:22:41

This doesn't seem to work in all cases. For example, my header files
are located in a sub-directory of my main project directory. DB
doesn't find them there to add to the Makefile, but if I explicitely
include them in my source, changing from this:
#include "someheader.h"
to
#include "inc/someheader.h"
Then DB does find the header to include in the Makefile.

I'll just stick with the rules I posted previously, but it would be a
real nice feature if DB could keep track of the header dependencies
like this. This may take little more then adding an include file path
in some DB settings window, or even teaching DB to parse this info
from the compiler arguments setting.

I'm assuming the average user will assume that DB includes header info
in the makefiles (since most IDEs do), and it can waste a lot of time
tracking down program crashes caused by imcomplete builds.

Rgds,
Steve

--- In anthemion-devtoolsyahoogroups.com, "ddotedotsdot"
<dsilvia...> wrote:
&gt;
> Hi!
>
> I was toying around trying to find a little more generic method of
> doing dependecies that would work for any GCC compatible make utility
&gt; on the various platforms on which it's available when I discovered
> that if you regenerate the makefile enough times in DB it eventually
> picks up all dependencies and includes them properly (???!!!) Not
> sure why it doesn't seem to work on a first go...
>;
> Anyway, both our efforts may be for naught. Just regenerate the
> makefile a couple (2 or 3?) of times when adding new headers and the
> makefile DB generates should work fine.
>;
> fyi,
> Dave S.
>
> --- In anthemion-devtoolsyahoogroups.com, "sglow2000" <sglow> wrote:
&gt; >
> > Hi Dave;
>; >
> > OK, thanks. I had assumed that dialogblocks would track these
>; > dependencies for me.
> >
> > For anyone else who's interested, here are a couple lines that can be
> > added to the end of the Makefile which will automatically track all
> > the dependencies. This uses gcc, so will probably only work under
>; Linux:
&gt; >
> > Rgds,
>; > Steve
>; >
> > ### End DialogBlocks generated body
> >
> > dep/%.d : c/%.cpp
&gt; > echo ........... Building $
> > mkdir -p dep
> > gcc -MM $(CPPFLAGS) -MT $(patsubst c/%.cpp,$(OBJECTPATH)/%.o,$<)
> $< > $
> > gcc -MM $(CPPFLAGS) -MT $(patsubst c/%.cpp,dep/%.d,$<;) $< >> $
> >
> > include $(patsubst $(OBJECTPATH)/%.o,dep/%.d,$(OBJECTS))
&gt; >
> >
> >
> >
> >
> > --- In anthemion-devtoolsyahoogroups.com, "ddotedotsdot&quot;
> > <dsilvia> wrote:
&gt; > >
> > > Hi!
> > >
> > > DB only knows about dependencies it generates. It does not
parse user
> > > code for any reason, it only modifies and regenerates code enclosed
> > > within its comment markers. It also assumes a one-to-one
relationship
> > > between implementation files (.cpp) and header files (.h).
>; > >
> > > What you can do is modify the makefile within the DB editor.
Open the
> > > Sources folder in the Project tree and select the makefile.
This will
> > > open the source editor with the makefile displayed. Go to the
bottom
> > > of the makefile, after the comment marker. Let's say, just for
> > > discussion purposes, you have a wxFrame class named DoodleFrame with
> > > files named doodleframe.cpp and doodleframe.h. In the makefile
there
> > > will be a target:
&gt; > >
> > > $(OBJECTPATH)/doodleframe.o: doodleframe.cpp doodleframe.h
> > > $(CXX) -c -o $ $(CPPFLAGS) $(GCCFLAGS) $(DEBUGFLAGS) $(OPTFLAGS)
> > > $(WARNINGFLAGS) $(CPPINC) doodleframe.cpp
>; > >
> > > (second line is wrapped...)
> > >
> > > What you do, is at the bottom of the makefile you add another
target.
>; > > Let's say you have a second header named nulla.h that doodleframe
> > > depends on, this is what the target at the bottom of the
makefile will
> > > look like:
>; > >
> > > $(OBJECTPATH)/doodleframe.o: nulla.h
&gt; > >
> > >
> > > (NOTE: no second line with a build command)
> > > This will cause doodleframe.o to be remade by the previous rule
> > > whenever nulla.h is modified.
> > >
> > > HTH,
> > > Dave S.
> > >
> > > --- In anthemion-devtoolsyahoogroups.com, "sglow2000" <sglow>
wrote:
> > > >
> > > > I've noticed that the makefiles generated by dialogblocks
don't seem
> > > > to include most of the header files in my project. As a result I
> > > > often have to hit 'rebuild all' in order to properly build my
> project.
> > > >
> > > > This is true for most, but not all the headers. The headers
&gt; that are
> > > > specified in the 'implementation header file' property of a
> dialog do
> > > > seem to be added. The majority of my headers are not used to
> define a
> > > > dialog however, and are not listed in the makefile.
> > > >
> > > > Am I missing some setting in dialogblocks that will allow me
to tell
> > > > it where to find the headers? They are all located in a
> sub-directory
> > > > under the main project directory.
> > > >
> > > > I have added the option -Iinc to the include path settings for my
> > > > compiler (under build->configurations), so the compiler is able to
> > > > find the headers when it compiles.
> > > >
> > > > Thanks,
&gt; > > > Steve
>; > > >
> > >
> >
>

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )