我正在开发一个游戏,它有一堆链接在一起的类。工作正常,但现在一切都乱套了。
1>------ Build started: Project: Razoo, Configuration: Debug Win32 ------
1> Main.cpp
1>c:\users\ronan\desktop\c++\razoo\razoo\inventory.h(62): warning C4172: returning address of local variable or temporary
1>c:\users\ronan\desktop\c++\razoo\razoo\inventory.h(65): warning C4172: returning address of local variable or temporary
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(21): error C2143: syntax error : missing ';' before '*'
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(24): error C2061: syntax error : identifier 'Room'
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(76): error C2143: syntax error : missing ';' before '*'
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(76): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(77): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(79): warning C4183: 'GetCurrentRoom': missing return type; assumed to be a member function returning 'int'
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(31): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(31): error C2065: 'p_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(32): error C2065: 'p_inventory' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(42): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(78): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(108): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(108): error C2227: left of '->GetNorth' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(113): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(113): error C2227: left of '->GetSouth' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(118): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(118): error C2227: left of '->GetEast' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(123): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(123): error C2227: left of '->GetWest' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(156): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(158): error C2065: 'm_currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(158): error C2227: left of '->GetName' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(22): error C2227: left of '->GetName' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(22): error C2228: left of '.length' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(27): error C2227: left of '->GetName' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(72): error C2227: left of '->GetDesc' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(84): error C2227: left of '->GetNorth' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(88): error C2227: left of '->GetNorth' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(88): error C2227: left of '->GetName' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(91): error C2227: left of '->GetSouth' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(95): error C2227: left of '->GetSouth' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(95): error C2227: left of '->GetName' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(98): error C2227: left of '->GetEast' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(102): error C2227: left of '->GetEast' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(102): error C2227: left of '->GetName' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(105): error C2227: left of '->GetWest' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(109): error C2227: left of '->GetWest' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(109): error C2227: left of '->GetName' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(115): error C2227: left of '->GetInventory' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(115): error C2228: left of '.Size' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(116): error C2227: left of '->GetInventory' must point to class/struct/union/generic type
1> type is 'int *'
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(116): error C2228: left of '.GetItemNames' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\generalutils.h(154): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(128): error C2143: syntax error : missing ';' before '&'
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(128): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(128): error C2061: syntax error : identifier 'HashTable'
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(129): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(214): warning C4183: 'InitializeRooms': missing return type; assumed to be a member function returning 'int'
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(216): error C2061: syntax error : identifier 'HashTable'
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(130): error C2065: 'p_filename' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(155): error C2065: 'Room' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(155): error C2065: 'temp' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(183): error C2065: 'Room' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(183): error C2146: syntax error : missing ';' before identifier 'room'
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(183): error C2065: 'temp' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(183): error C3861: 'room': identifier not found
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(185): error C2065: 'p_roomtable' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(185): error C2228: left of '.Insert' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(185): error C2065: 'room' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(185): error C2228: left of '.GetName' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(202): error C2065: 'p_roomtable' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(202): error C2228: left of '.Find' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(202): error C2227: left of '->m_data' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(202): error C2228: left of '.SetNorth' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(204): error C2065: 'p_roomtable' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(204): error C2228: left of '.Find' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(204): error C2227: left of '->m_data' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(204): error C2228: left of '.SetSouth' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(206): error C2065: 'p_roomtable' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(206): error C2228: left of '.Find' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(206): error C2227: left of '->m_data' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(206): error C2228: left of '.SetEast' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(208): error C2065: 'p_roomtable' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(208): error C2228: left of '.Find' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(208): error C2227: left of '->m_data' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(208): error C2228: left of '.SetWest' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(212): error C2146: syntax error : missing ';' before identifier 'level'
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(212): error C2065: 'p_roomtable' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(212): error C2228: left of '.Find' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(212): error C2227: left of '->m_data' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(212): error C3861: 'level': identifier not found
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(213): error C2065: 'level' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(218): error C2065: 'p_filename' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(231): error C2065: 'Room' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(231): error C2065: 'currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(253): error C2065: 'currentRoom' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(253): error C2065: 'p_rooms' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(253): error C2228: left of '.Find' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(253): error C2227: left of '->m_data' must point to class/struct/union/generic type
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(263): error C2065: 'p_numItems' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(265): error C2065: 'p_items' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(265): error C2228: left of '.GetName' must have class/struct/union
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(267): error C2065: 'p_items' : undeclared identifier
1>c:\users\ronan\desktop\c++\razoo\razoo\initializer.h(272): error C2065: 'currentRoom' : undeclared identifier
1>d:\programs\microsoft visual studio 11.0\vc\include\regex(1670): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我认为我在某处有一个不匹配的大括号,或者缺少 ; 在课程结束时,但我确实检查了代码中的每一个,所以我认为我排除了这一点。
从第一个错误开始:
1>c:\users\ronan\desktop\c++\razoo\razoo\player.h(21): error C2143: syntax error : missing ';' before '*'
以及它指向的代码:
#ifndef PLAYER_H
#define PLAYER_H
#include <string>
#include <fstream>
#include "Room.h"
#include "Inventory.h"
#include "Array.h"
class Player
{
private:
string m_name;
int m_health;
int m_confidence;
int m_humor;
int m_speed;
Room* m_currentRoom; //Line 21
Inventory m_inventory;
在我看来,它#include "Room.h"
工作不正常?
我是否混合了某种循环依赖项(我现在还没有完全理解它们)?
还是有一些其他“常见”问题会一起调用所有这些错误?
第一次在这里发帖,所以不确定你是否需要更多代码或任何东西(或者我是否搞砸了任何合成器!)
谢谢!