I know I haven't defined each of these functions more than once, and surely
not in four or five files, as the linker is stating. I must be doing
something else wrong. Any insights or things to try? I would greatly
Without more specific examples, it's hard to know exactly what's going
wrong. A good technique is to recreate the problem in a minimal set of
In this case, data variables might be declared in header files without
"extern", which means each source file including that header gets its
own "int foo". That's all I can suggest at the moment.
Keep at it. Eventually the light starts to dawn.
Nick Costa <njc...@aol.com> wrote:
> I feel ridiculous continuously posting, and i'm starting to think the
> board's getting tired of it, but i must post anyway. My knowledge of linker
> errors is not that vast. I am getting 14 linker errors. Each is on a
> different occurrence, but they are all the same error: "Multiply defined".
> Some are descriptor, some are data, and some are code.
> I know I haven't defined each of these functions more than once, and surely
> not in four or five files, as the linker is stating. I must be doing
> something else wrong. Any insights or things to try? I would greatly
> appreciate it.
You can't generate date in a header and include that header in more than
one source file. If you do a #define me 2 then in another file #define me
3 you get a redefintion error, If you have a header with a structure or
type in a header and it isn't static const or external you will have
problems like that.
What you have to do is put these type of things in a source file then
declare them external in the header. You can then use that header for many
source files without getting redefinition errors. One other thing to do
is put them in the Prefix file but that is not as portable as using the
Specials on Renewals, New Purchases, Books and Bundles
METROWERKS Ron Liechty
"Software at Work" MW...@metrowerks.com
>I know I haven't defined each of these functions more than once, and surely
>not in four or five files, as the linker is stating. I must be doing
>something else wrong. Any insights or things to try? I would greatly
One of the simplest mistakes that leads to multiple definition warnings is
typing #include "myfile.c" or #include "myfile.cpp" when you meant to type
#include "myfile.h" in your include list in another source file. The
linker sees the definition of those items once when myfile is added to the
project and again when it's included in the other source file(s).
Senior Software Engineer
Key Curriculum Press