[Click] compiling my package with click

Bart Braem bart.braem at ua.ac.be
Mon Feb 20 03:16:28 EST 2006


On Monday 20 February 2006 06:21, Ges wrote:
> I am writing my own package, similar to the example etc/samplepackage. As
> mentioned in my previous mail, I would like to override the -fno-rtti
> option for compilation. 

You might want to change the Makefile defaults using CFLAGS=-O0 ./configure 
but I don't think you can omit those flags. I think they are used to allow 
in-kernel Click.

> Also right now most of the classes I have written 
> are not click elements, and many of them refer to each other: example,
> Class Edge includes objects of Class endpoint. As mentioned in the FAQ, I
> have used ELEMENT_PROVIDES(Edge) and ELEMENT_REQUIRES(userlevel Endpoint)
> etc in all the source files. But when I run 'make install' it always tries
> to compile another source file Class BasicFlowgraph, which uses objects of
> Edge, Endpoint and other classes. How do I modify the Makefile in a way to
> ensure that all the files compile in the right order, so that I can compile
> the whole package without any problems. I couldnt find anything on the
> mailing list that gave me a solution. Please help.

This is a basic C++ problem. In your headers use forward declarations of your 
classes combined with include guards. 
You should get something like this in e.g. BasicFlowGraph.hh:
#ifndef ...
#define ...

class Edge;
class EndPoint;
class BasicFlowgraph{
...
}
#include "Edge.hh"
#include "EndPoint.hh"
#endif

Then everything can be compiled in any order. 

Bart
-- 
Bart Braem
PATS research group
Dept. of Mathematics and Computer Sciences
University of Antwerp
G2.36, Building G
Middelheimlaan 1
2020 Antwerpen, Belgium
Phone: +32 (0)3 265.35.19.
Fax: +32 (0)3 265.37.77.
Web: www.pats.ua.ac.be
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: not available
Url : https://amsterdam.lcs.mit.edu/pipermail/click/attachments/20060220/bc5bc38e/attachment.pgp


More information about the click mailing list