Linux compile error: Recipes.h

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:

Linux compile error: Recipes.h

Post by John Adams » Tue Feb 19, 2013 3:45 pm

Jab, I have not compiled any Linux binaries in quite a while, so this issue introduced sometime late Jan just showed up. I cannot compile Login, Patch or World on Linux.

The error is:

Code: Select all

eq2dev@eq2dev:~/src/EQ2/source/LoginServer$ make
g++ -c -Wall -Wuninitialized -Wwrite-strings -Wcast-qual  -Wcomment -Wcast-align -Wno-deprecated -g -march=i686 -O -pthread -pipe -DFX -D_GNU_SOURCE -DINVERSEXY -DEQ2 -DLOGIN -I/usr/include/mysql -I/usr/mysql/include ../common/Mutex.cpp -o ../common/Mutex.o
In file included from ../common/../common/../WorldServer/Player.h:31,
                 from ../common/../common/../WorldServer/zoneserver.h:33,
                 from ../common/../common/../WorldServer/client.h:26,
                 from ../common/../common/Log.h:24,
                 from ../common/Mutex.cpp:22:
../common/../common/../WorldServer/Recipes/Recipe.h:171: error: extra qualification âMasterRecipeList::â on member âGetRecipesâ
make: *** [../common/Mutex.o] Error 1
The code is Recipes.h:

Code: Select all

	/// <summary>Gets all the recipes for the given book name</summary>
	/// <param name="book_name">Book name to get recipes for</param>
	/// <returns>A vector of all the recipes for the given book</returns>
	vector<Recipe*>* MasterRecipeList::GetRecipes(const char* book_name);
Any suggested fixes?

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: Linux compile error: Recipes.h

Post by John Adams » Tue Feb 19, 2013 3:52 pm

lol, you won't believe this... but I accidentally figured it out. Soon as I paid attention to the words "extra qualifier" I noticed you have the function declared as MasterRecipeList::GetRecipes() (yes, the error even says "MasterRecipeList::" hah)

Apparently, Linux is not so forgiving of bad copy/paste matters ;)

I'll leave this post here for future reference.

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: Linux compile error: Recipes.h

Post by John Adams » Tue Feb 19, 2013 4:17 pm

Okay, well here is an actual error I cannot solve. We ran into this before when you were using min/max functions that Linux doesn't like (can't remember where that was). Do you recall?

Code: Select all

g++ -c -Wall -Wuninitialized -Wwrite-strings -Wcast-qual  -Wcomment -Wcast-align -Wno-deprecated -g -march=i686 -O -pthread -pipe -DFX -D_GNU_SOURCE -DINVERSEXY -DEQ2 -DWORLD -I/usr/include/mysql -I/usr/mysql/include -I./LUA/include Tradeskills/TradeskillsPackets.cpp -o Tradeskills/TradeskillsPackets.o
Tradeskills/TradeskillsPackets.cpp: In static member function âstatic void ClientPacketFunctions::SendCreateFromRecipe(Client*, int32)â:
Tradeskills/TradeskillsPackets.cpp:100: error: no matching function for call to âmin(int, int8)â
make: *** [Tradeskills/TradeskillsPackets.o] Error 1
Now I remember... it's in WinDef.h, which of course, isn't in Linux right?

Code: Select all

#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif
How do I get around this?

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Linux compile error: Recipes.h

Post by Scatman » Tue Feb 19, 2013 6:29 pm

I believe we have a linx header in common called Linux.h or Unix.h. You can try copy/pasting those defs in there. I can check around 10pm est when i'm home if you want.

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

Re: Linux compile error: Recipes.h

Post by Jabantiz » Tue Feb 19, 2013 7:51 pm

Copy and paste always seems to kick my ass...

As for the Min/Max thing I used those because I always thought they were easier to read, habit I picked up from my early days of programming. They can be replaced with the code in the defines

Code: Select all

a > b ? a : b
Will try to remember to use that for now on.

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: Linux compile error: Recipes.h

Post by John Adams » Tue Feb 19, 2013 8:52 pm

Jab, you did this once before when you first started submitting fixes, I cannot remember what we did to get around it. I searched the code for min(...) (pretty sure it was something about tradeskills then?) but couldn't find anything. I'm striking out on Search here too because of the commonality of "min" hah.

If you can remember, let's do the same thing we did to fix that last time on Linux, or Scatman, yes... gimme a Linux fix so Jab can use what he knows cross-platform.


Ahh hah! Found the old post here. Although this solution might have been for something completely different. You are casting it as a int8, and I am pretty sure the "1" is an int8 :)

I'll let you chew on it overnight. I'd like to get dev world back on it's feet though. Been playing around a bit ;)

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

Re: Linux compile error: Recipes.h

Post by Jabantiz » Tue Feb 19, 2013 9:52 pm

I remember that old issue now, in linux the values need to be of the exact same type, just putting a number treats it as an int (error says min(int, int8)) so try this

Code: Select all

packet->setDataByName("primary_selected_item_qty", min((int8)1, (int8)item->details.count));

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: Linux compile error: Recipes.h

Post by John Adams » Wed Feb 20, 2013 8:08 am

I must have snuck my edit in after you replied ;)

That worked (thanks!), but that makes no sense. You have to cast an integer? haha... no wonder I'm a database guy.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests