[erlang-questions] Erlang programming question: "record abc already defined"

Anthony Kong <>
Sun Jul 8 23:56:38 CEST 2007


Hi, all,

It is a erlang question form a firsttime beginner. So, bear with me if
the source of problem is obvious.

I got a bunch of message like this when I run erlc against a number of
erl files. Here are some examples:

./reqmgt.hrl:14: record project already defined
./reqmgt.hrl:14: record project already defined
./reqmgt.hrl:14: record project already defined
./reqmgt.hrl:14: record project already defined
./reqmgt.hrl:14: record project already defined
./reqmgt.hrl:14: record project already defined

Let's say I have these files regmgt.erl, regmgt.hrl, project.erl,
abc.erl, def.erl.

Except for the hrl files, they are all
1) based on the gen_server_template.mini from Joe's book
2) project, abc, def contains logic related to a particular record
class. So, project.erl knows how to handle -record(proect, {...})
3) I am a java programmer, so the design of the project.erl, abc, def
are  basically to handle CRUD.
4) reqmgt.erl is an implementation following a Facade pattern.
5) each of these erl files has a line "-include (reqmgt.hrl)"

in reqmgt.hrl I have define  "-record(project, {...})" and abc, def  etc.

(Yes, I am using hrl as if it is a C include file but not knowing how
to do "#ifndef" :-) )

So, questions:

1) Is it wrong to use "-include" this way? If so, how to fix it?
2) Does this 'design' sound OK in erlang?

Sorry, googling using erlang and "-include" come up with a lot of
noise. If it is already mentioned in OTP manual, pls kindly let me
know the relevant url/section.


Cheers, Anthony
-- 
/*--*/
Experience is simply the name we give our mistakes.
---- Oscar Wilde



More information about the erlang-questions mailing list