Moderator: MacroQuest Developers
This must be due to a compiler setting. Modern C++ compilers scope variables defined in for loop as local to the loop.mamba666 wrote:I keep getting a compilation error when I try to compile mq2main:
C:\My Downloads\EQ\Macroquest 2011\MQ2-20110415a\MQ2Main\MQ2Utilities.cpp(1009) : error C2374: 'n' : redefinition; multiple initialization
C:\My Downloads\EQ\Macroquest 2011\MQ2-20110415a\MQ2Main\MQ2Utilities.cpp(998) : see declaration of 'n'
MQ2Windows.cpp
Generating Code...
Error executing cl.exe.
MQ2Main.dll - 1 error(s), 0 warning(s)
Am I the only one getting this error? This happened with both the MQ2-20110415 and MQ2-20110415a releases.

See the paragraph starting with "Alternatively" in my original response.eqsomebody wrote:I'm getting the same error. I'm using Microsoft Visual C++ v6.0. I've been compiling MQ2 with this version for 7 years and have never had to change a properties setting to the best of my knowledge. If that is what is needed, could someone be kind enough to let me know as I do not know what to change.
There is no properties setting for this in VC6, I found some suggestions online about how to get around it but those just generated even more errors. I have not tried the suggestions regarding removing DWORDeqsomebody wrote:I'm getting the same error. I'm using Microsoft Visual C++ v6.0. I've been compiling MQ2 with this version for 7 years and have never had to change a properties setting to the best of my knowledge. If that is what is needed, could someone be kind enough to let me know as I do not know what to change.
Thanks!
This works as far as compiling in VC6, not sure what issues it may cause... line 1009 is the 2nd for loop belowDeeprave wrote:Alternatively you can remove the "DWORD" in front of n on line 1009, however you're likely to hit the same problem elsewhere.
Code: Select all
WORD GetGuildIDByName(PCHAR szGuild)
{
for(DWORD n = 0; n < pGuildList->HashValue - 1; n++) {
if(PGUILD pGuild = pGuildList->GuildList[n]) {
while (pGuild) {
if(!stricmp(pGuild->pGuildData->Name, szGuild))
return pGuild->ID;
pGuild = pGuild->pNext;
}
}
}
for(DWORD n = 0; n < pGuildList->HashValue - 1; n++) {
if(PGUILD pGuild = pGuildList->GuildList[n]) {
while (pGuild) {
if(!strnicmp(pGuild->pGuildData->Name, szGuild, strlen(szGuild)))
return pGuild->ID;
pGuild = pGuild->pNext;
}
}
}
return 0xFFFF;
}


Dittowoobs wrote:I am using VC++ 2008 Express on Win 7 64. No problems.