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 file my_func.hh, you insert the code:

#endif


I think this should solve your problem.

----------------------------------------------------------------------------------------------------------------------------------------------
Francisco Carlos Silva Junior
PhD Student at University of Brasilia


________________________________
De: gem5-users <gem5-users-boun...@gem5.org> em nome de yuan <syu...@ncsu.edu>
Enviado: quinta-feira, 7 de novembro de 2019 11:28
Para: gem5 users mailing list <gem5-users@gem5.org>
Assunto: [gem5-users] Question about compile after adding global funcs


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”, but when I re-compile the gem5, it always shows the error of 
multiple definition of “the name of my func”. Does anyone have some hints on 
this?



Best,



Yuan



Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to