From NetHackWiki
Jump to navigation Jump to search

Problems compiling?

I'm running FreeBSD 10.1 prerelease and I got the following

apply.c:4111:4: error: non-void function 'doapply' should return a value



Any help? Elronnd(talk) 21:35, 18 April 2015 (UTC)

I can't really help...
Hmmm, try "return 0;" ??? in ./src/apply.c line 4111.
It seams FreeBSD is using "LLVM/Clang" now instead of gcc. You'll likely get more errors. You could try using a different compiler? On linux it works with gcc version 4.8.2. You could also try with "make -i", it will ignore all errors.--Quantum Immortal (talk) 00:38, 19 April 2015 (UTC)
I tried switching to gcc, and that didn't help. Return 0 didn't work either. Make -i compiled everything except for the slashthem executable... Elronnd(talk) 20:50, 19 April 2015 (UTC)
Are you sure you didn't forgot to save when you put that 0? It compiled fine here. What was the error this time? try with "1" too (it compiles with that too here). Try with different versions of gcc... probably close to 4.8.2 or the oldest one of the ones available. You should stick with gcc however, they will be less errors. You really used gcc? You have to edit ./src/Makefile. By setting the variable CC you'll force it to use a specific compiler (you can have several versions of gcc installed). Line 59 and bellow they are some stuff you could try. Just comment out "return;" for now( compiles here), see if they are more errors. By commenting out, try to find all the errors. Ask Amy( try also with slashem extended) and the guys of slashthem.--Quantum Immortal (talk) 23:37, 19 April 2015 (UTC)
Actually just realized that it did fix it: there were just more of them. However, now I've got a completely different problem (the only error left):
   pager.c:1246:8: error: duplicate case value '255'
                   case AT_MAGC: return "uses magic spell(s)";
Elronnd(talk) 18:54, 21 April 2015 (UTC)
Keep in mind i don't now that much about programming. I think the actual error is in the definition of ./include/monattk.h .One of the values is (-1), i think it instead warps around as the maximum value. In ./include/monattk.h , give "(-1)" to the variable AT_MAGC (the same value as AT_ANY). Try to compile, if it complains again "duplicate case value '255'". Then this is it.
Hmmm, try removing the "()" around the -1 in the include, or try "-(1)" (both compiled over here). If you comment out line 1246 of pager.c ,i think it will only brake Pokedex a bit. They are probably other errors related to this one, that weren't detected by the compiler....--Quantum Immortal (talk) 23:22, 21 April 2015 (UTC)
No monster uses AT_ANY, so you might just remove that line from pager.c and it will compile (see SLASH'EM Extended pager.c). --Bluescreenofdeath (talk) 07:53, 22 April 2015 (UTC)
It's not AT_ANY, though, it's AT_MAGC. EDIT: Ah, I get it: comment out AT_ANY, and it will compile correctly. Thanks, that fixed it.Elronnd(talk) 20:58, 23 April 2015 (UTC)

You should make a list of all the necessary changes, and submit them to slashthem and slashem extended. Normally, it should be compiling out of the box, on both gcc and clang.--Quantum Immortal (talk) 01:29, 24 April 2015 (UTC)

I specifically didn't do that, because as versions change, there may be differences. I haven't tested with Slash'EM Extended yet, but I imagine that it will be mainly the same. I was able to get away with using "GNUmakefile", I'm not sure if it will work with the stock one. I will make sure to test with SLEX, though.Elronnd(talk) 04:03, 24 April 2015 (UTC)
I meant, that it should compile without editing all that stuff. The "return 0" and "AT_ANY" changes should compile everywhere. Report those.--Quantum Immortal (talk) 12:15, 24 April 2015 (UTC)
I still think that "return 0" and "AT_ANY" changes can go in the official sources.--Quantum Immortal (talk) 15:55, 25 April 2015 (UTC)
Apparently they have: "< Soviet5lo> Elronnd: I implemented your FreeBSD fixes"