Don't conflate two different variables named "i" and two different variables named "n". Clang errors on these variable redefinitions. The "i" variable part of this patch is equivalent to what was done upstream, as seen in this GitHub mirror's commit: https://github.com/x3ro/VisualBoyAdvance/commit/722a30419a30345be3c2ebf6ef85689067ea7005 --- src/sdl/debugger.cpp.orig 2004-05-13 09:13:14.000000000 -0500 +++ src/sdl/debugger.cpp 2018-10-07 21:32:20.000000000 -0500 @@ -1275,12 +1275,12 @@ #define ASCII(c) (c) < 32 ? '.' : (c) > 127 ? '.' : (c) -void debuggerMemoryByte(int n, char **args) +void debuggerMemoryByte(int nn, char **args) { - if(n == 2) { + if(nn == 2) { u32 addr = 0; sscanf(args[1], "%x", &addr); - for(int i = 0; i < 16; i++) { + for(int ii = 0; ii < 16; ii++) { int a = debuggerReadByte(addr); int b = debuggerReadByte(addr+1); int c = debuggerReadByte(addr+2); @@ -1310,13 +1310,13 @@ debuggerUsage("mb"); } -void debuggerMemoryHalfWord(int n, char **args) +void debuggerMemoryHalfWord(int nn, char **args) { - if(n == 2) { + if(nn == 2) { u32 addr = 0; sscanf(args[1], "%x", &addr); addr = addr & 0xfffffffe; - for(int i = 0; i < 16; i++) { + for(int ii = 0; ii < 16; ii++) { int a = debuggerReadByte(addr); int b = debuggerReadByte(addr+1); int c = debuggerReadByte(addr+2); @@ -1346,13 +1346,13 @@ debuggerUsage("mh"); } -void debuggerMemory(int n, char **args) +void debuggerMemory(int nn, char **args) { - if(n == 2) { + if(nn == 2) { u32 addr = 0; sscanf(args[1], "%x", &addr); addr = addr & 0xfffffffc; - for(int i = 0; i < 16; i++) { + for(int ii = 0; ii < 16; ii++) { int a = debuggerReadByte(addr); int b = debuggerReadByte(addr+1); int c = debuggerReadByte(addr+2);