期待一个;声明错误后c ++ Xcode?

时间:2014-04-28 18:21:54

标签: c++ xcode class

所以我想知道是否有人可以阅读代码并看到任何错误: 这是包含错误的文件

#ifndef Game_part_1_Cluenumber2_h
#define Game_part_1_Cluenumber2_h
#include <iostream>
#include "Clue.cpp"
#include "casesp1.h"
using namespace std;
int &refcrimetWo = crime;
int clue.setClues(10, 14, 14)(){    
}
void clueTwo()
{
    int
    clue.raNdom();
}
#endif

这是类文件:

#include "Clue.h"
#include <iostream>
#include <string>
#include<fstream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
class clue {
    string evidenceop1, evidenceop2, evidenceop3;
public:

    //    int choose (void);
    string werk = "";
    int setClues(int x,int y,int z);

    void raNdom(){


        srand(time(NULL));
        signed int x = rand() %3;
        switch(x){
            case 1:
                werk = evidenceop1;
                break;
            case 2:
                werk = evidenceop2;
                break;
            default:
                werk = evidenceop3;
                break;
        }




    }
//    void fInal(){return werk;};
} Clue;

非常感谢,错误来自int clue.setClues(10, 14, 14)(){}

这不是主文件,但在主文件中我从不调用函数

1 个答案:

答案 0 :(得分:0)

编译器将此语句视为声明

int clue.setClues(10, 14, 14)(){    

至于我,我不知道这句话的意思。

首先,除了将声明用作初始化表达式之外,您不能在命名空间范围内调用函数。其次,函数不是你所写的方式。