This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to prevent Error: L6200E: Symbol multiply defined?

Hi guys,

I'm receiving the Error: 'L6200E: Symbol multiply defined'.

I understand one workaround is to include externs, however this is unideal. With most compilers/linkers something such as:

#ifndef bla
#define bla

// Content

#endif

Would prevent double inclusion, however it doesn't appear to work with Keil.

Any ideas on a similar solution?

Many thanks

Parents
  • That's just because you rarely use globals in C++, the same problem would have occurred in C++ if you had tried the same thing.

    Instead you hand around pointers and references. The advantage is that pointers are just addresses, so declaring a class is sufficient, you don't need to know any internals to be able to create a pointer to it. References are just a different syntax for constant pointers (not pointers to constants), so the same applies to them.

Reply
  • That's just because you rarely use globals in C++, the same problem would have occurred in C++ if you had tried the same thing.

    Instead you hand around pointers and references. The advantage is that pointers are just addresses, so declaring a class is sufficient, you don't need to know any internals to be able to create a pointer to it. References are just a different syntax for constant pointers (not pointers to constants), so the same applies to them.

Children
No data