Can't make
g++ -O3 -c item.cpp -o obj/item.o item.cpp: In member function ‘std::string item::info(bool)’: item.cpp:282:43: error: ‘struct it_comest’ has no member named ‘health’ "\n Healthiness: " << int(food->health); ^
make: *** [obj/item.o] Error 1
this is what i get.How to solve it?
Unfortunately, since I was replacing my old hard drive with a new one, I had to do one last commit of Cataclysm - in a non-working state. I'd try pulling one or two commits before the latest one. One of those should compile!
On Sun, Apr 6, 2014 at 2:10 PM, Henorvell Ge [email protected]:
g++ -O3 -c item.cpp -o obj/item.o item.cpp: In member function 'std::string item::info(bool)': item.cpp:282:43: error: 'struct it_comest' has no member named 'health' "\n Healthiness: " << int(food->health); ^ make: *** [obj/item.o] Error 1
this is what i get.How to solve it?
Reply to this email directly or view it on GitHubhttps://github.com/Whales/Cataclysm/issues/73 .
I got it to work.
First bug: line 282 of item.cpp. Add the letter y to the end of the world health.
Here's the relevant compilation message, not sure how to put it in a code tag on github: item.cpp: In member function ‘std::string item::info(bool)’: item.cpp:282:43: error: ‘struct it_comest’ has no member named ‘health’ "\n Healthiness: " << int(food->health); ^ make: *** [obj/item.o] Error 1
To fix the second bug, I commented out line 314 of iuse.cpp.
g++ -O3 -c iuse.cpp -o obj/iuse.o iuse.cpp: In member function ‘void iuse::vitamins(game_, player_, item_, bool)’: iuse.cpp:314:77: error: ‘add_msg’ was not declared in this scope add_msg("You have the feeling that these vitamins won't do you any good."); ^ make: *_* [obj/iuse.o] Error 1
Third bug is a set of bugs with map.cpp.
g++ -O3 -c map.cpp -o obj/map.o map.cpp: In member function ‘bool map::sees(int, int, int, int, int, int&)’: map.cpp:1923:15: error: ‘x’ was not declared in this scope if (!trans(x, y)) ^ map.cpp:1935:1: error: expected primary-expression before ‘bool’ bool map::sees(int Fx, int Fy, int Tx, int Ty, int range, int &tc) ^ map.cpp:2432:1: error: expected ‘,’ or ‘;’ at end of input } ^ map.cpp:2432:1: error: expected ‘}’ at end of input map.cpp:2432:1: error: expected ‘}’ at end of input make: *** [obj/map.o] Error 1
So how did you fix the 3rd set of bugs? - looking at the code i guess you could just comment that whole function?
im working on it and it's not the whole last block from 1935 as id hoped. literally the functions where the errors happen. is what the previousposters meant I believe. Edit: Solved the Wreturn errors that happened by inserting "return 0;" I'm left with backwards compat issues. I'm new to compiling so will update this.
My take on the compilation errors. I'll leave it here for anyone trying to compile Cataclysm.
Error 1: iuse.cpp:314:77: error: ‘add_msg’ was not declared in this scope
Solution: iuse.cpp, line 314, replace add_msg with g->add_msg.
Error 2: item.cpp:282:43: error: ‘struct it_comest’ has no member named ‘health’; did you mean ‘healthy’?
Solution: item.cpp, line 282, replace health with healthy.
Error 3: game.h:56:8: error: invalid initialization of non-const reference of type ‘calendar&’ from an rvalue of type ‘calendar’
Solution: Comment-out or delete the whole operator thing because it's not used anywhere else. Maybe it can be fixed some other way, but this seems to work fine.
calendar.h, line 55, comment it: // calendar& operator = (calendar &rhs);
calendar.cpp, line 55 to 86, comment all /* ... */
Error 4: map.cpp:1923:15: error: ‘x’ was not declared in this scope
Reason is map::sees is unfinished, like //WIP: faster map::sees comment suggests.
Solution: delete the unfinished implementation, because it is followed by an old one.
map.cpp, line 1915, delete lines from 1915 to 1929.
Segfault: Then I get a segfault on game start that is related to the unarmed styles macro. The problem is this line: setvector((static_cast<it_style*>(itypes[index]))->moves, __VA_ARGS__, NULL); which apparently writes moves for each style. Commenting this line fixes the segfault but breaks unarmed styles.