"pow" and "remove" - Yet Another Linux Fail

Support forum for questions about compiling and running EQ2Emulator on Linux.

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:

"pow" and "remove" - Yet Another Linux Fail

Post by John Adams » Sat Jan 18, 2014 8:14 am

I seem to be getting a linux compile fail every SVN checkout lately... c'mon guys, be gentle to linux, too. It's what your services run on :)

Error 1

Code: Select all

g++ -c -Wall -g -march=i686 -O -pthread -pipe -DFX -D_GNU_SOURCE -DINVERSEXY -DEQ2 -DWORLD -I/usr/include/mysql -I/usr/mysql/include -I./LUA/include LuaFunctions.cpp -o LuaFunctions.o
LuaFunctions.cpp: In function int EQ2Emu_lua_AddSpellBonus(lua_State*):
LuaFunctions.cpp:1470: error: pow was not declared in this scope
LuaFunctions.cpp: In function int EQ2Emu_lua_AddSpawnSpellBonus(lua_State*):
LuaFunctions.cpp:1548: error: pow was not declared in this scope
.
.
.
Edit: Fix for pow():

Code: Select all

#include <math.h>


Error 2

Code: Select all

g++ -c -Wall -g -march=i686 -O -pthread -pipe -DFX -D_GNU_SOURCE -DINVERSEXY -DEQ2 -DWORLD -I/usr/include/mysql -I/usr/mysql/include -I./LUA/include net.cpp -o net.o
net.cpp: In function ‘int main(int, char**)’:
net.cpp:344: error: ‘remove’ is not a member of ‘std’
make: *** [net.o] Error 1
Still looking for remove()

Edit: Since we have using namespace std; in the net.cpp, do we need the std::remove()? Not that remove() would work any better, just curious why the added namespace.

I attempted to add

Code: Select all

#ifndef WIN32
  #include <cstdio>
#endif
but that just caused it to explode the iterator, so I'll leave this fix up to you, Jab.

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: "pow" and "remove" - Yet Another Linux Fail

Post by John Adams » Sat Jan 18, 2014 8:51 am

btw, this fails on Windows compile too, so I am not sure how you tested it.
1>..\..\source\WorldServer\LuaFunctions.cpp(1470): error C2668: 'pow' : ambiguous call to overloaded function
EQ2TC does still use VS2010 though, maybe VS2012 has made development even lazier ;)

Edit: The fix for Windows appears to be making the pow(2, ...) into a pow(2.0, (double)(...))

LUAFunctions.cpp, line 1470:

Code: Select all

class_req += pow(2.0, (double)(class_id - 1));
line 1548

Code: Select all

class_req += pow(2.0, (double)(class_id - 1));


Entity.cpp, line 841

Code: Select all

int32 class1 = pow(2.0, (GetAdventureClass() - 1));
int32 class2 = pow(2.0, (classes.GetSecondaryBaseClass(GetAdventureClass()) - 1));
int32 class3 = pow(2.0, (classes.GetBaseClass(GetAdventureClass()) - 1));
For some reason, it didn't make me (double) these last 3...

And should all these calcs be cast to (int32)pow(...) anyway?

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

Re: "pow" and "remove" - Yet Another Linux Fail

Post by Jabantiz » Sat Jan 18, 2014 10:05 am

John Adams wrote:btw, this fails on Windows compile too, so I am not sure how you tested it.
1>..\..\source\WorldServer\LuaFunctions.cpp(1470): error C2668: 'pow' : ambiguous call to overloaded function
EQ2TC does still use VS2010 though, maybe VS2012 has made development even lazier ;)
I knew there was a reason why I liked 2012....

For me I just hit compile and got no errors.

Will look into remove, thought it would have been in Linux as it is std.

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

Re: "pow" and "remove" - Yet Another Linux Fail

Post by Jabantiz » Sat Jan 18, 2014 1:45 pm

needed to include <algorithm> for std::remove will commit this now

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests