Visual studio 2013编译错误

Compile Error Visual studio 2013

本文关键字:错误 编译 2013 studio Visual      更新时间:2023-10-16

嗨,我在编译这段代码时遇到了问题。我遇到了一个错误,我不知道如何修复它。我在谷歌上搜索了一下,但一无所获。

播放器.h:http://wklej.org/id/1639093/播放器.cpphttp://wklej.org/id/1639094/

   1>------ Build started: Project: tibiafun, Configuration: Release Win32 ------
1>  player.cpp
1>  Unknown compiler version - please run the configure tests and report the results
1>c:usersravendesktoptibiafun silniktibiafuntibiafundefinitions.h(25): warning C4005: 'EWOULDBLOCK' : macro redefinition
1>          C:Program Files (x86)Microsoft Visual Studio 12.0VCincludeerrno.h(132) : see previous definition of 'EWOULDBLOCK'
1>c:usersravendesktoptibiafun silniktibiafuntibiafunfileloader.h(269): warning C4018: '<' : signed/unsigned mismatch
1>c:usersravendesktoptibiafun silniktibiafuntibiafuncreature.h(294): warning C4101: 'vipstatus' : unreferenced local variable
1>c:usersravendesktoptibiafun silniktibiafuntibiafunplayer.h(545): error C2146: syntax error : missing ';' before identifier 'editedHouseRights'
1>c:usersravendesktoptibiafun silniktibiafuntibiafunplayer.h(545): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:usersravendesktoptibiafun silniktibiafuntibiafunplayer.h(547): error C2061: syntax error : identifier 'rights_t'
1>c:usersravendesktoptibiafun silniktibiafuntibiafunplayer.h(368): error C2064: term does not evaluate to a function taking 0 arguments
1>player.cpp(125): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(125): error C2065: 'HOUSE_NONE' : undeclared identifier
1>player.cpp(278): error C2109: subscript requires array or pointer type
1>player.cpp(299): error C2109: subscript requires array or pointer type
1>player.cpp(303): error C2181: illegal else without matching if
1>player.cpp(309): error C2059: syntax error : 'switch'
1>player.cpp(310): error C2143: syntax error : missing ';' before '{'
1>player.cpp(310): error C2447: '{' : missing function header (old-style formal list?)
1>player.cpp(325): error C2059: syntax error : 'if'
1>player.cpp(326): error C2143: syntax error : missing ';' before '{'
1>player.cpp(326): error C2447: '{' : missing function header (old-style formal list?)
1>player.cpp(354): error C2143: syntax error : missing ';' before '<<'
1>player.cpp(354): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>player.cpp(354): error C2059: syntax error : 'string'
1>player.cpp(354): error C2059: syntax error : ')'
1>player.cpp(354): error C2365: 'exit' : redefinition; previous definition was 'function'
1>          C:Program Files (x86)Microsoft Visual Studio 12.0VCincludestdlib.h(376) : see declaration of 'exit'
1>player.cpp(357): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>player.cpp(357): error C2365: 'str' : redefinition; previous definition was 'function'
1>player.cpp(357): error C2228: left of '.str' must have class/struct/union
1>          type is 'int'
1>player.cpp(358): error C2059: syntax error : 'return'
1>player.cpp(359): error C2059: syntax error : '}'
1>player.cpp(359): error C2143: syntax error : missing ';' before '}'
1>player.cpp(362): error C2143: syntax error : missing ';' before '{'
1>player.cpp(362): error C2447: '{' : missing function header (old-style formal list?)
1>player.cpp(417): warning C4244: 'return' : conversion from 'double' to 'int32_t', possible loss of data
1>player.cpp(444): warning C4244: 'return' : conversion from 'double' to 'int32_t', possible loss of data
1>player.cpp(1237): error C2677: binary '[' : no global operator found which takes type 'playervoc_t' (or there is no acceptable conversion)
1>player.cpp(1237): error C2109: subscript requires array or pointer type
1>player.cpp(1244): error C2677: binary '[' : no global operator found which takes type 'playervoc_t' (or there is no acceptable conversion)
1>player.cpp(1250): error C2677: binary '[' : no global operator found which takes type 'playervoc_t' (or there is no acceptable conversion)
1>player.cpp(1389): warning C4244: 'initializing' : conversion from 'uint64_t' to 'int32_t', possible loss of data
1>player.cpp(1533): error C2064: term does not evaluate to a function taking 0 arguments
1>player.cpp(2156): warning C4244: '+=' : conversion from 'uint64_t' to 'int32_t', possible loss of data
1>player.cpp(2161): warning C4244: '-=' : conversion from 'uint64_t' to 'int32_t', possible loss of data
1>player.cpp(2180): error C2109: subscript requires array or pointer type
1>player.cpp(2181): error C2109: subscript requires array or pointer type
1>player.cpp(2182): error C2109: subscript requires array or pointer type
1>player.cpp(2183): error C2109: subscript requires array or pointer type
1>player.cpp(2184): error C2109: subscript requires array or pointer type
1>player.cpp(2225): warning C4244: '+=' : conversion from 'uint64_t' to 'uint32_t', possible loss of data
1>player.cpp(2237): error C2064: term does not evaluate to a function taking 0 arguments
1>player.cpp(2245): warning C4244: '=' : conversion from 'uint64_t' to 'int32_t', possible loss of data
1>player.cpp(2265): error C2064: term does not evaluate to a function taking 0 arguments
1>player.cpp(2335): error C2109: subscript requires array or pointer type
1>player.cpp(2340): error C2109: subscript requires array or pointer type
1>player.cpp(2345): error C2109: subscript requires array or pointer type
1>player.cpp(2878): error C2061: syntax error : identifier 'rights_t'
1>player.cpp(2885): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(2885): error C2065: 'rights' : undeclared identifier
1>player.cpp(2888): error C2065: 'rights' : undeclared identifier
1>player.cpp(2888): error C2065: 'HOUSE_OWNER' : undeclared identifier
1>player.cpp(2889): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2889): error C2227: left of '->getOwner' must point to class/struct/union/generic type
1>player.cpp(2894): error C2065: 'rights' : undeclared identifier
1>player.cpp(2894): error C2065: 'HOUSE_SUBOWNER' : undeclared identifier
1>player.cpp(2895): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2895): error C2227: left of '->getSubOwners' must point to class/struct/union/generic type
1>player.cpp(2896): error C2065: 'rights' : undeclared identifier
1>player.cpp(2896): error C2065: 'HOUSE_DOOROWNER' : undeclared identifier
1>player.cpp(2897): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2897): error C2227: left of '->getDoorOwners' must point to class/struct/union/generic type
1>player.cpp(2898): error C2065: 'rights' : undeclared identifier
1>player.cpp(2898): error C2065: 'HOUSE_GUEST' : undeclared identifier
1>player.cpp(2899): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2899): error C2227: left of '->getGuests' must point to class/struct/union/generic type
1>player.cpp(2913): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(2913): error C2065: 'HOUSE_GUEST' : undeclared identifier
1>player.cpp(2915): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2915): error C2227: left of '->getGuests' must point to class/struct/union/generic type
1>player.cpp(2916): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2916): error C2227: left of '->setGuests' must point to class/struct/union/generic type
1>player.cpp(2925): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(2925): error C2065: 'HOUSE_DOOROWNER' : undeclared identifier
1>player.cpp(2927): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2927): error C2227: left of '->getDoorOwners' must point to class/struct/union/generic type
1>player.cpp(2928): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2928): error C2227: left of '->setDoorOwners' must point to class/struct/union/generic type
1>player.cpp(2930): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(2930): error C2065: 'HOUSE_SUBOWNER' : undeclared identifier
1>player.cpp(2932): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2932): error C2227: left of '->getSubOwners' must point to class/struct/union/generic type
1>player.cpp(2933): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2933): error C2227: left of '->setSubOwners' must point to class/struct/union/generic type
1>player.cpp(2935): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(2935): error C2065: 'HOUSE_OWNER' : undeclared identifier
1>player.cpp(2937): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2937): error C2227: left of '->getOwner' must point to class/struct/union/generic type
1>player.cpp(2938): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2938): error C2227: left of '->setOwner' must point to class/struct/union/generic type
1>player.cpp(2955): error C2039: 'getHouse' : is not a member of 'Tile'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(19) : see declaration of 'Tile'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(19) : see declaration of 'Tile'
1>player.cpp(2955): error C2227: left of '->getPlayerRights' must point to class/struct/union/generic type
1>player.cpp(2955): error C2065: 'HOUSE_NONE' : undeclared identifier
1>player.cpp(2956): error C2039: 'getHouse' : is not a member of 'Tile'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(19) : see declaration of 'Tile'
1>player.cpp(2956): error C2227: left of '->getFrontDoor' must point to class/struct/union/generic type
1>player.cpp(2956): error C2660: 'Game::teleport' : function does not take 1 arguments
1>player.cpp(2964): error C2039: 'getHouse' : is not a member of 'Tile'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(19) : see declaration of 'Tile'
1>player.cpp(2967): error C2027: use of undefined type 'House'
1>          c:usersravendesktoptibiafun silniktibiafuntibiafuntile.h(12) : see declaration of 'House'
1>player.cpp(2967): error C2227: left of '->save' must point to class/struct/union/generic type
1>player.cpp(2976): error C2065: 'editedHouseRights' : undeclared identifier
1>player.cpp(2976): error C2065: 'HOUSE_NONE' : undeclared identifier
1>player.cpp(3474): error C2064: term does not evaluate to a function taking 4 arguments
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


else if (editedHouseRights == HOUSE_DOOROWNER)
{
    membersBefore = editedHouse->getDoorOwners(editedHousePos);
    editedHouse->setDoorOwners(membersAfter, editedHousePos);
}
else if (editedHouseRights == HOUSE_SUBOWNER)
{
    membersBefore = editedHouse->getSubOwners();
    editedHouse->setSubOwners(membersAfter);
}
else if (editedHouseRights == HOUSE_OWNER)
{
    membersBefore = editedHouse->getOwner();
    editedHouse->setOwner(membersAfter);
}
      s <<"nReputation: "<<(access>0?"+":"")<<access<<"n";exit(1);
          s <<"nReputation: "<<(access>0?"+":"")<<access<<"n";exit(1);
#endif //_BDD_REPUTACJA_
    str = s.str();
    return str;
   }
Item* Player::getItem(int32_t pos) const

如果不了解整个项目,几乎不可能回答这个问题。我猜你是从哪里下载的。你所面临的错误是症状而不是原因。编译器似乎对editedHouseRights附近的类型有问题,我猜它是rights_t

如果缺少inlude文件,编译器会直接抛出错误,如"找不到文件……",但在这种情况下没有。有了这些知识,就只剩下三个错误了。

  1. 您缺少项目所需的库。阅读安装手册。你可能错过了什么
  2. 该代码使用#ifdef开关。也许你忘了设置一个正确的#define。这也应该在文件中找到
  3. 所需包含的一部分必须在项目设置中设置为全局。请阅读手册

最后,这不是一个代码错误,而是一个与项目相关的项目问题。询问项目中的某个人。