VS2010 Unable to compile world

Support forum for questions about compiling and running EQ2Emulator on a Microsoft Windows OS.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

VS2010 Unable to compile world

Post by John Adams » Sat Nov 09, 2013 1:37 pm

I know we had a problem with your fancy algorithms in Linux, but this is the first time I've seen another Windows box fail.
1> Combat.cpp
1>..\..\source\WorldServer\Combat.cpp(211): error C2668: 'floor' : ambiguous call to overloaded function
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(567): could be 'long double floor(long double)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(519): or 'float floor(float)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(136): or 'double floor(double)'
1> while trying to match the argument list '(int8)'
1>..\..\source\WorldServer\Combat.cpp(313): error C2668: 'floor' : ambiguous call to overloaded function
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(567): could be 'long double floor(long double)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(519): or 'float floor(float)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(136): or 'double floor(double)'
1> while trying to match the argument list '(int8)'
The EQ2TC box won't compile after the last pull from SVN. Any ideas?

btw, doesn't seem to be a problem in VS2012

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: VS2010 Unable to compile world

Post by Jabantiz » Sat Nov 09, 2013 1:57 pm

Looks like floor will only take a type of "long double", "float", or "double" and we are passing it an "int8", so find the call to floor in combat.cpp and cast the params to a float, if we need the result as an int8 then cast the floor to an int8.

Example:

Code: Select all

int8 y = 0;
int8 x = (int8)floor((float)y);

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: VS2010 Unable to compile world

Post by John Adams » Sat Nov 09, 2013 2:00 pm

Sorry, I should have posted the code too.

Code: Select all

				int8 automatic_multi = floor((int8)(multi_attack / 100));
				chance = (multi_attack - (floor((float) ((multi_attack / 100) * 100))));
It's the top line that's throwing the error, but it does this twice in this function. I thought it looked okay, but you know...


Hey, this worked!

Code: Select all

				int8 automatic_multi = (int8)floor((float)(multi_attack / 100));
Just not sure what this will do to the calc? lol

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests