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

.h file need include in two c source files

Hello,
I have two c source files in my project, and they both need include hardware.h(register define) file. I try to include the .h file to both C file but the compilter says the memory overlap. I choice include .h file to the main C file ,the compiliter says another c file's register not define.
How to avoid it ,
thanks a lot.

Parents
  • You are probably defining stuff in the header file.
    Your header file should contain only the extern declarations.

    It's probably a Linker error you're seeing - not a compiler error?

    This has been discussed often here before - including quite recently. Try browsing back a bit, or do a 'Search'

    Note that it's all standard 'C' stuff - nothing specifically to do with Keil.
    Therefore, any decent 'C' textbook should be able to help you.

Reply
  • You are probably defining stuff in the header file.
    Your header file should contain only the extern declarations.

    It's probably a Linker error you're seeing - not a compiler error?

    This has been discussed often here before - including quite recently. Try browsing back a bit, or do a 'Search'

    Note that it's all standard 'C' stuff - nothing specifically to do with Keil.
    Therefore, any decent 'C' textbook should be able to help you.

Children