Compilation Error

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

mamba666
a lesser mummy
a lesser mummy
Posts: 49
Joined: Fri Aug 15, 2003 11:47 am

Compilation Error

Post by mamba666 » Sat Apr 16, 2011 1:42 am

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.

Deeprave
a ghoul
a ghoul
Posts: 115
Joined: Sun Jul 11, 2010 9:46 am

Re: Compilation Error

Post by Deeprave » Sat Apr 16, 2011 2:13 am

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.
This must be due to a compiler setting. Modern C++ compilers scope variables defined in for loop as local to the loop.

Somewhere in properties (since you don't say what version I can't guess as to where) there should be a setting for "force conformance in for loop scope" and set that to "Yes". The wording may be different, I'm reading that from VC++ 2010 project properties.

Alternatively you can remove the "DWORD" in front of n on line 1009, however you're likely to hit the same problem elsewhere.

eqsomebody
a lesser mummy
a lesser mummy
Posts: 74
Joined: Thu Jul 29, 2004 10:36 am

Re: Compilation Error

Post by eqsomebody » Sat Apr 16, 2011 7:40 am

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!

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Re: Compilation Error

Post by wolf5 » Sat Apr 16, 2011 8:10 am

I am using Visual Studio 2010. Opening the "old" solution file every time and upgrading it to VS2010. Compile works with no probs.

If all else fails try VS2010.

Deeprave
a ghoul
a ghoul
Posts: 115
Joined: Sun Jul 11, 2010 9:46 am

Re: Compilation Error

Post by Deeprave » Sat Apr 16, 2011 8:39 am

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.
See the paragraph starting with "Alternatively" in my original response.

I'm guessing it is due to VC++6 getting a little long in the tooth. There *should* be some setting that will enable this since for loop variable scoping is in C++ standard for over a decade now, but may need to be enabled for the older compiler as a leftover from the days when it had proposal status only. VS2008 and 2010 certainly have it set by default.

Edit: just looked it up, VC++ 6.0 was released in 1989. Yes, getting very aged. Kudos to the MQ2 maintainers for keeping the code backwards compatible (well, apart from this :-)).

Targ
orc pawn
orc pawn
Posts: 15
Joined: Wed Oct 20, 2004 1:36 pm

Re: Compilation Error

Post by Targ » Sat Apr 16, 2011 9:54 am

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.

Thanks!
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 DWORD

Targ
orc pawn
orc pawn
Posts: 15
Joined: Wed Oct 20, 2004 1:36 pm

Re: Compilation Error

Post by Targ » Sat Apr 16, 2011 10:12 am

Deeprave wrote:Alternatively you can remove the "DWORD" in front of n on line 1009, however you're likely to hit the same problem elsewhere.
This works as far as compiling in VC6, not sure what issues it may cause... line 1009 is the 2nd for loop below

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;
}

eqsomebody
a lesser mummy
a lesser mummy
Posts: 74
Joined: Thu Jul 29, 2004 10:36 am

Re: Compilation Error

Post by eqsomebody » Sat Apr 16, 2011 11:29 am

Thanks for the replies. The extent of my compilier ability is to set the active project and execute two build commands.

Where would I 'fix' the DWORD mentioned above?

Thanks in advance.

eqsomebody
a lesser mummy
a lesser mummy
Posts: 74
Joined: Thu Jul 29, 2004 10:36 am

Re: Compilation Error

Post by eqsomebody » Sat Apr 16, 2011 11:37 am

Disregard my last e-mail. I found the file in the directory and deleted the 'DWORD' as pointed out.

So far so good...

Thanks!

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Re: Compilation Error

Post by dont_know_at_all » Sat Apr 16, 2011 12:51 pm

Fixed in next zip...

mamba666
a lesser mummy
a lesser mummy
Posts: 49
Joined: Fri Aug 15, 2003 11:47 am

Re: Compilation Error

Post by mamba666 » Sat Apr 16, 2011 8:09 pm

Thanks, dont_kown_at_all!! :D

I was just looking at the costs and options to getting Visual Studio 2010!

Making a donation to the Developers here instead! :lol:
Last edited by mamba666 on Sat Apr 16, 2011 8:20 pm, edited 1 time in total.

Olain
a snow griffon
a snow griffon
Posts: 477
Joined: Sun May 15, 2005 12:45 am

Re: Compilation Error

Post by Olain » Sat Apr 16, 2011 8:13 pm

Get the free express version. Why buy it?

mamba666
a lesser mummy
a lesser mummy
Posts: 49
Joined: Fri Aug 15, 2003 11:47 am

Re: Compilation Error

Post by mamba666 » Sat Apr 16, 2011 8:23 pm

I thought the Express version did not work for x64 systems. :(

woobs
a grimling bloodguard
a grimling bloodguard
Posts: 627
Joined: Thu Dec 10, 2009 11:53 am

Re: Compilation Error

Post by woobs » Sat Apr 16, 2011 8:56 pm

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

Olain
a snow griffon
a snow griffon
Posts: 477
Joined: Sun May 15, 2005 12:45 am

Re: Compilation Error

Post by Olain » Sat Apr 16, 2011 9:36 pm

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