我一直在尝试让我从学校服务器下载的程序在我的 Mac 上离线运行。我尝试按照教程更新 GCC,由于某种原因,即使我使用给定的命令,教程也不起作用。
现在当我编译时..我收到一个错误说没有找到..我不明白。我已经更新了 Xcode.. 遵循了大量的教程.. 我仍然无法运行它!
为什么说random is not found,导致致命错误?
谢谢
错误:
DungeonLevel.h:6:10: fatal error: 'random' file not found
“由于这是一个编码站点,我需要提供代码,因为我可能忘记包含头文件......”
#ifndef _DungeonLevel_included_
#define _DungeonLevel_included_
#include "Tile.h"
#include <vector>
#include <random>
class Player;
class DungeonLevel {
public:
DungeonLevel(int iWidth, int iHeight, std::mt19937 & randomGen);
~DungeonLevel(void);
void dump();
char at(int x, int y);
Creature * removeCreature(Creature * creatureToRemove);
void moveCreature(Creature * creatureToMove, char dir);
void placeInGame(Creature * creatureToPlace, std::mt19937 & randomGen);
void placeInGame(Creature & creatureToPlace, std::mt19937 & randomGen);
Tile & returnTile(int x,int y);
int getWidth();
int getHeight();
private:
std::vector<std::vector<Tile>> m_vvTiles; //Tile was char
};
#endif
这是我的生成文件:
OBJECTS = Ammunition.o Armor.o Consumable.o Creature.o Entity.o Gold.o Item.o parser.o Potion.o Scroll.o Weapon.o XMLSerializable.o CreatureFactory.o DungeonLevel.o Player.o Tile.o ItemFactory.o
HEADERS = Ammunition.h Armor.h Consumable.h Creature.h Entity.h Gold.h Item.h parser.h Potion.h Scroll.h Weapon.h XMLSerializable.h CreatureFactory.h DungeonLevel.h Player.h Tile.h ItemFactory.h
all: Jhack
%.o: %.cpp $(HEADERS)
clang++ -c $< -o $@ -std=c++11 -stdlib=libc++
Jhack: $(OBJECTS) main.o
clang++ -o Jhack $^ -stdlib=libc++
clean:
rm -f *.o Jhack
run: Jhack
./Jhack