On 11/7/19 2:28 PM, yuan wrote:
> Hi, All,
>
> I suffered one problem of multiple definition when compiling, what I did
> is adding some new functions I need in a file name my_func.hh under
> src/mem/, and in the file cache.cc where I need these functions I use
> #include “mem/my_func.hh”, bu
Hi, Francisco Carlos,
Thanks for your reply. I do add ifndef in mycode. I have added a lot
self-defined fucns before by adding the ifndef-define-endif. BUt this
morning, I always suffer from this error. The errors are as follows:
build/X86/mem/cache/lib.o.partial: In function `':
/home/syuan3
Hi, Yuan
Did you use #ifdef in your file my_func.hh?
You should use #ifdef to avoid multiple definitions and circular includes.
So, in the first line of your file my_func.hh, you must insert the following
code:
#ifndef _MEM_MY_FUNC_HH_
#define _MEM_MY_FUNC_HH_
And in the last line of your fi