esp32-gameboy icon indicating copy to clipboard operation
esp32-gameboy copied to clipboard

compilation error : multiple definition of `mem_init'

Open wdmomoxx opened this issue 2 years ago • 4 comments

I don't know what went wrong. The compilation tips are as follows

Can you help me

C:\Users\ASUS\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/lib\liblwip.a(mem.o): In function `mem_init':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/mem.c:76: multiple definition of `mem_init'
C:\Users\ASUS\AppData\Local\Temp\arduino_build_126247\sketch\mem.cpp.o:C:\Users\ASUS\Desktop\esp32-gameboy\gameboy/mem.cpp:202: first defined here
collect2.exe: error: ld returned 1 exit status

wdmomoxx avatar Sep 07 '22 07:09 wdmomoxx

Hi, I seem to be having the same issue.

From what I can tell, it's something to do with declaring the variable in both the header and the C++ file. But I don't know how to fix it.

Were you able to solve the problem?

StarOceanBlue avatar Apr 03 '23 07:04 StarOceanBlue

I ended up just renaming the function to "mem_init2" and went through the following files to adjust it: gameboy.ino, main.cpp, mem.cpp, mem.h. I was able to compile it afterwards.

gslance avatar May 19 '23 00:05 gslance

I ended up just renaming the function to "mem_init2" and went through the following files to adjust it: gameboy.ino, main.cpp, mem.cpp, mem.h. I was able to compile it afterwards.

Can you explain the changes you have made ?

damian17pl avatar Dec 08 '23 09:12 damian17pl

Can you explain the changes you have made ?

Just find and replace mem_init to mem_init2 in these 4 files; gameboy.ino, main.cpp, mem.cpp, mem.h.

Its as simple as that

simplyrohan avatar May 21 '24 00:05 simplyrohan