Page 1 of 1

Compilation issues with rev709-710

Posted: Tue Oct 14, 2014 9:34 am
by Blackstorm
Hi,

Follow this trick to compile the rev710 under Linux (Debian).

I only have updated the Gcc 4.7.2 to the new one on unstable sources (4.9.1) in case of the problem was with the c++11 directives but it should work with gcc 4.7+

- First, like John said, add in the "Makefile", at the end after "Combat.o" this :

Code: Select all

Combat.o \
PatchServer.o \
MasterSpawnList.o
- 2nd : You need to edit the MasterSpawnList.cpp and find this code :

Line 110 :

Code: Select all

npc_list.AddNpc(make_shared<Npc>(npc_spawns[spawn_id], itr.second));
replace by :

Code: Select all

auto myNpc = make_shared<Npc>(npc_spawns[spawn_id], itr.second);
npc_list.AddNpc(myNpc);
Line 134 :

Code: Select all

ppo_list.AddPPO(make_shared<PlayerPlacedObject>(ppo_spawns[itr2.spawn_id], itr.second));
replace by :

Code: Select all

auto myPPO = make_shared<PlayerPlacedObject>(ppo_spawns[itr2.spawn_id], itr.second);
ppo_list.AddPPO(myPPO);
Line 170 :

Code: Select all

mover_list.AddMover(make_shared<Mover>(itr));
replace by :

Code: Select all

auto myMover = make_shared<Mover>(itr);
mover_list.AddMover(myMover);
- 3rd, edit MasterSpawnList.h

Line 157-158 should be only :

Code: Select all

MasterSpawnList();
~MasterSpawnList();

Do "make" ^^

You could have a warning/notice about Lua :

Code: Select all

../Lua/liblua5-2-3.a(loslib.o): dans la fonction « os_tmpname »:
loslib.c:(.text+0x29c): AVERTISSEMENT: the use of `tmpnam' is dangerous, better use `mkstemp'
but not sure, maybe it's only on my server ^^

Enjoy!!
Twuce ^^

Re: Compilation issues with rev709-710

Posted: Tue Oct 14, 2014 9:57 am
by Lokked
You can also declare (in the AddNpc/PPO/Mover functions in their respective classes) the const qualifier before the shared_ptr<Npc/PlayerPlacedObject/etc> and it will compile. Thanks to Ratief for finding this particular solution.

Thanks for sleuthing this out, Blackstorm!

Re: Compilation issues with rev709-710

Posted: Tue Oct 14, 2014 10:32 am
by John Adams
Ratief has made an official fix for this, and my linux world is once again compiling. After I've had some time to test a few recent code commits, and possible fix to recent crashes, I will update Public SVN with fixed Linux, code and new vgo_world.sql schema.

Re: Compilation issues with rev709-710

Posted: Tue Oct 14, 2014 10:36 am
by Blackstorm

Can i have a concret example for the fix please ? i would like to understand the solution ^^ (i understand the looked's post but i am not a c++ dev so i don't see how the code fully works^^)

Re: Compilation issues with rev709-710

Posted: Tue Oct 14, 2014 10:40 am
by John Adams
Example, very simple fix which is exactly what StackOverflow responses suggested:

Change:

Code: Select all

void NpcList::AddNpc(shared_ptr<Npc>& npc)
To

Code: Select all

void NpcList::AddNpc(const shared_ptr<Npc>& npc)

Re: Compilation issues with rev709-710

Posted: Tue Oct 14, 2014 10:41 am
by Blackstorm
ahh ^^ ok, thanks a lot for the example ^^