“{”令牌错误前预期的非限定id

expected unqualified-id before ‘{’ token error

本文关键字:id 令牌 错误      更新时间:2023-10-16
#include <iostream>
#include "proj1.h"
using namespace std;
//Deciphers a message. cip[] is a char array containing a Cipher message                                                            
//as a null-term.                                                                                                                   
void Decipher(char Cip[], char key);
{
  char intCip[];
  char intMessage[];
  char cipher[];
  int intKey = key - 'A';
  for( int i = 0; i < strlen(Cip); i++)
    {
      if(Cip[i] >= 'A' && Cip[i] <= 'Z')
        {
          intCip[i] = key - Cip[i];
        }
    }
  for( int i = 0; i < strlen(Cip); i++)
    {
      Cip[i] = (intCip[i] + (intKey % 26));
    }
}
char SolveCipher(const char Cip[], char dec[]);
{
  return 0;
}
int main()
{
  Decipher (ciper[0], 'R');
  return 0;
}

我得到这个错误信息时,我试图使。exe

g++ -Wall proj1.cpp -o program
proj1.cpp:8: error: expected unqualified-id before ‘{’ token
make: *** [program] Error 1

这是什么意思?我看不出在'{'之前我需要什么,因为它开始了函数定义。

有;

void Decipher(char Cip[], char key); // notice the semicolon

表示函数原型声明。要定义一个函数,需要删除分号

去掉void Decipher(char Cip[], char key)后面的分号