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

multiply defined variables when linking.

Hi again. New problem. I creaated a new project that only has main.c
file1.c and file1.h

file1.h is #included in main.c which contains a global variable.

When I build all I get :-
.\scope.axf: Error: L6200E: Symbol global_VAR multiply defined (by main.o and file.o).

How do I get round this?

I have googled around but don't quite understand the issue.

Parents
  • Start by showing us what your code looks like.

    But I guess you forgot the "extern" keyword in the header file, to just inform the compiler that there "somewhere" exists a variable with that name and type.

    Don't mix up declaration and definition.

Reply
  • Start by showing us what your code looks like.

    But I guess you forgot the "extern" keyword in the header file, to just inform the compiler that there "somewhere" exists a variable with that name and type.

    Don't mix up declaration and definition.

Children