Compile error in spl-summoning.cc


Problems running or configuring the software, commands & options, compiling, different platforms, using the interface, documentation, etc.

User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Thursday, 9th May 2013, 02:17

Compile error in spl-summoning.cc

I am getting the following error message when I try to compile Trunk, in both console and tiles mode:
  Code:
CXX spl-summoning.o
spl-summoning.cc: In function ‘bool aim_battlesphere(actor*, spell_type, int, bolt&)’:
spl-summoning.cc:2571: error: no match for ‘operator!=’ in ‘i != std::vector<_Tp, _Alloc>::rend() [with _Tp = coord_def, _Alloc = std::allocator<coord_def>]()’
make: *** [spl-summoning.o] Error 1

Attempting to compile with -d gives, after several pages of "Pruning file" and "Prerequisite" messages:
  Code:
CXX spl-summoning.o
Putting child 0x1002a91f0 (spl-summoning.o) PID 2656 on the chain.
Live child 0x1002a91f0 (spl-summoning.o) PID 2656
spl-summoning.cc: In function ‘bool aim_battlesphere(actor*, spell_type, int, bolt&)’:
spl-summoning.cc:2571: error: no match for ‘operator!=’ in ‘i != std::vector<_Tp, _Alloc>::rend() [with _Tp = coord_def, _Alloc = std::allocator<coord_def>]()’
Reaping losing child 0x1002a91f0 PID 2656
make: *** [spl-summoning.o] Error 1
Removing child 0x1002a91f0 PID 2656 from chain.

I am running Mac OS X 10.6.8 and attempting to compile with Xcode version 3.2.6 (Because more recent versions of Xcode can't be used on Snow Leopard). I am using the default compile command for Macs in INSTALL.txt:
  Code:
make APPLE_GCC=y NO_PKGCONFIG=y CONTRIB_SDL=y TILES=y

(The console version default just has the APPLE_GCC=y tag)
On IRC my nick is reaverb. I play online under the name reaver, though.
User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Thursday, 9th May 2013, 02:32

Re: Compile error in spl-summoning.cc

I used "make clean" and then attempted to recompile. I got the same error.
On IRC my nick is reaverb. I play online under the name reaver, though.

Ziggurat Zagger

Posts: 3163

Joined: Friday, 6th January 2012, 18:45

Post Thursday, 9th May 2013, 03:16

Re: Compile error in spl-summoning.cc

User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Friday, 10th May 2013, 02:34

Re: Compile error in spl-summoning.cc

I just looked through the threads, but I didn't find a solution. The first simply didn't have the problem I had (I suspect the poster with the problem has a later version of Mac OSX or Xcode, and sent him a private message to check.) The second had both the same error and the same version of Mac OSX, but the given solution was "wait for the Trunk binaries to be updated." (I would like to modify the code).

Looking at the error more closely, I realize a couple things about it. First it throws the error at this bit of code:
  Code:
2566         if (!actor_at(beam.target))
2567         {
2568             testbeam.fire();
2569
2570             for (vector<coord_def>::const_reverse_iterator i = testbeam.path_taken.rbegin();
2571                 i != testbeam.path_taken.rend(); ++i)
2572             {
2573                 if (*i != battlesphere->pos() && monster_at(*i))
2574                 {
2575                     battlesphere->props["firing_target"] = *i;
2576                     battlesphere->foe = actor_at(*i)->mindex();
2577                     battlesphere->props["foe"] = battlesphere->foe;
2578                 }
2579             }


The code is from the function bool aim_battlesphere(actor* agent, spell_type spell, int powc, bolt& beam) of spl-summoning.cc. Furthermore, according to this stack exchange: http://stackoverflow.com/questions/10149059/no-match-for-operator-c-compile-error the error "no match for ‘operator!=’" is caused by the program not knowing how to compare two objects. This means that for some reason, the program fails to see how testbeam.path_taken.rbegin() and testbeam.path_taken.rend() can be compared.

Since the problem is in just this function, I can compile crawl by commenting out the offending code and making the function always return false. Not an ideal solution, but I can start modifying crawl if it works. This will be identical to crawl Trunk except battlespheres won't work.

I will not be readily available over the weekend, so if somebody posts something I might not be able to respond until Monday or Tuesday.
On IRC my nick is reaverb. I play online under the name reaver, though.

Dungeon Master

Posts: 1531

Joined: Saturday, 5th March 2011, 06:29

Post Friday, 10th May 2013, 02:43

Re: Compile error in spl-summoning.cc

There are some open issues on the bugtracker about this:

https://crawl.develz.org/mantis/view.php?id=6049
https://crawl.develz.org/mantis/view.php?id=6882

Maybe you could try building with Clang or some of those other build environments mentioned.
User avatar

Dungeon Master

Posts: 502

Joined: Wednesday, 7th March 2012, 13:25

Location: Lexington, KY, US

Post Saturday, 11th May 2013, 00:17

Re: Compile error in spl-summoning.cc

It turns out this is a defect in the C++03 standard. For this specific problem, see:
http://stackoverflow.com/questions/2135 ... rs-missing

It seems to work in gcc 4.1.2, but I suspect you have 4.0 (gcc --version will tell you). I just pushed a workaround to trunk (0.13-a0-694-g9be4cfb). We don't technically support gcc 4.0, but this fix is simple and unobtrusive enough.

Edit: I just confirmed, it was fixed in gcc 4.1: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11729

For this message the author neil has received thanks:
reaver
User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Sunday, 12th May 2013, 15:56

Re: Compile error in spl-summoning.cc

Thank you very much neil, I can compile now.
Oddly, it appears I have version 4.2.1 of gcc. I don't know why my computer had this bug.
I tried compiling with clang, but I got an error, just as here: https://crawl.develz.org/tavern/viewtopic.php?f=8&t=7515
  Code:
/bin/sh: clang++: command not found
make[1]: *** [tool/tile_colour.o] Error 127
make: *** [build-rltiles] Error 2
On IRC my nick is reaverb. I play online under the name reaver, though.

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 24 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.