c a header file realize of multiple .c file

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c a header file realize of multiple .c file相关的知识,希望对你有一定的参考价值。

//I write a few variables declaration,then include this head-file in multiple realization-c-file,then appear "multiple definition of ‘var1 ‘ " error

resolution:

  exists-file:myhead.h,realize1.c,realize2.c,main.c

  add:myhead.c

  1.move the defintion-entity-var at myhead.h to myhead.c

  2.in the myhead.h,announce these var through "extern".

以上是关于c a header file realize of multiple .c file的主要内容,如果未能解决你的问题,请参考以下文章

main.c: error: #13: expected a file name #include CMSIS_device_header main.c: 0 warnings, 1 error

“某事”的多重定义

关于 C/C++ 中使用的 header-guards 和 header-file 包含的说明

wordcount--realized by c

Creating your own header file in C

Build自己的kernel header