Compiling wesnoth 1.6.5 on Ubuntu 11.04

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
dshock
Posts: 1
Joined: August 20th, 2011, 9:43 pm

Compiling wesnoth 1.6.5 on Ubuntu 11.04

Post by dshock »

A friend of mine is using the wesnoth Iphone app, and we would like to play multiplayer together, so I am attempting to install wesnoth 1.6 on Ubuntu 11.04.

I receive an error:

In file included from /usr/include/c++/4.5/bits/stl_algobase.h:66:0,
from /usr/include/c++/4.5/bits/char_traits.h:41,
from /usr/include/c++/4.5/string:42,
from /home/shockldd/Downloads/wesnoth-1.6.5/src/tstring.hpp:18,
from /home/shockldd/Downloads/wesnoth-1.6.5/src/terrain.hpp:18,
from /home/shockldd/Downloads/wesnoth-1.6.5/src/map_location.hpp:23,
from /home/shockldd/Downloads/wesnoth-1.6.5/src/actions.hpp:35,
from /home/shockldd/Downloads/wesnoth-1.6.5/src/display.cpp:22:
/usr/include/c++/4.5/bits/stl_pair.h: In instantiation of ‘std::pair<map_location, unit>’:
/home/shockldd/Downloads/wesnoth-1.6.5/src/unit_map.hpp:118:30: instantiated from here
/usr/include/c++/4.5/bits/stl_pair.h:77:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
/home/shockldd/Downloads/wesnoth-1.6.5/src/actions.hpp:28:7: error: forward declaration of ‘struct unit’

Searching the internet turned up this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=619130

It sounds like changes between g++ 4.4 and 4.5 may be to blame. Any advice on how to deal with this?
RedAdder
Posts: 15
Joined: March 22nd, 2009, 8:48 pm

Re: Compiling wesnoth 1.6.5 on Ubuntu 11.04

Post by RedAdder »

Well, since this issue is old, I'll try to answer, even if i'm no expert on this:

This: http://stackoverflow.com/questions/2286 ... files-in-c
might be relevant; basically it means that you need to have the structure definition in map_location.cpp before where it is used in actions.hpp

You maybe could do that like this, if there isn't already a guarding ifndef in map_location.cpp(then you can forget about the guard):

Code: Select all

#ifndef MY_GUARD_MAP_LOCATION_CPP_INCLUDED
#define MY_GUARD_MAP_LOCATION_CPP_INCLUDED
#include "map_location.cpp"
#endif
Or, if map_location.cpp contains additional code besides the structure definition, move just the structure definition from map_location.cpp to map_location.hpp
The structure definition looks like this, with the dots indicating several lines of code:
struct map_location {..};

However, in 1.6.5, maybe it contains function definitions, which should not be in the .hpp file.

I am currently looking at
http://svn.gna.org/viewcvs/wesnoth/trun ... hrev=50735
and
http://svn.gna.org/viewcvs/wesnoth/trun ... hrev=50735

and it seems the latter is the right way to go.

Disclaimer: I'm not currently active as a C++ programmer.
Post Reply