1
  case CON_QCLASS:
    if ((GET_CLASS(d->character) = parse_class(*arg)) == CLASS_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a class.\r\nClass: ", d);
      return;
    else
    SEND_TO_Q(race_menu, d);
    SEND_TO_Q("\r\nRace: ", d);
    STATE(d) = CON_QRACE;
    break;

  case CON_QRACE:
    if ((GET_RACE(d->character) = parse_race(*arg)) == CLASS_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a race.\r\nRace: ", d);
      return;


    if (GETPFILEPOS(d->character) < 0)
      GETPFILEPOS(d->character) = create_entry(GET_NAME(d->character);
    init_char(d->character);
    save_char(d->character, NOWHERE);
    SEND_TO_Q(motd, d);
    SEND_TO_Q("\r\n\n*** PRESS RETURN: ", d);
    STATE(d) = CON_RMOTD;

    sprintf(buf, "%s [%s] new player.", GET_NAME(d->character), d->host);
    mudlog(buf, NRM, LVL_IMMORT, TRUE);
    break;

这是我得到的错误。

interpreter.c:71:3: error: expected identifier or ‘(’ before ‘case’`enter code here`

最重要的是违规方。我想也许我忘记了一些东西,比如上面的括号/括号/括号,但事实似乎并非如此。至少我猜是这样,因为错误仅在添加上述代码后发生。

编辑:对不起浪费你的时间,我意识到我的错误。我最终把它放在了我原本打算的地方,完全替换了我的一部分代码。我现在觉得很傻。感谢您的帮助。

4

2 回答 2

3

You are missing closing braces } for the if statements at the beginning of each case section.

于 2013-04-24T00:03:06.217 回答
0

if ((GET_CLASS(d->character) = parse_class(*arg)) == CLASS_UNDEFINED) {

forget } other too.

于 2013-04-24T00:03:33.933 回答