2011-07-31 12 views
0

まず:申し訳ありません私の悪い英語=((エラーC2146とC4430

Sencond:

ここに私のコードは "GLOBAL.H" にあります:

#pragma once 
class GlobalVariable 
{ 
public: 
    GlobalVariable(void); 
    ~GlobalVariable(void); 

    //------------------------------------------------ 
public: 
    double pixelWidth;  // do rong cua 1 pixel tren Viewport 
    double pixelHeigh;  // do cao cua 1 pixel tren Viewport 

public: 
    Point oldPoint, tempPoint; 
    Circle oldCir,  tempCir; 
    DaGiac oldDaGiac, tempDaGiac; 
    Color oldObjColor,tempObjColor, OxyColor; 

}; 

class Point 
{ 
public: 
    Point(void); 
    ~Point(void); 

    double x,y;   // toạ độ (x,y) 
}; 

class Color 
{ 
public: 
    Color(void); 
    ~Color(void); 

    double R,G,B;   // màu (R,G,B) 
}; 

class DaGiac 
{ 
public: 
    DaGiac(void); 
    ~DaGiac(void); 

    int numOfPeak; //so' dinh? 
    Point peakArr[10]; // ve da giac canh so dinh toi da la 10 
}; 

class Circle 
{ 
public: 
    Circle(void); 
    ~Circle(void); 

    Point centre; 
    double radius; 

};


と私はいくつかのエラーがあります:(

------ Build started: Project: GAS, Configuration: Debug Win32 ------ 
Compiling... 
GlobalVariable.cpp 
e:\documents\bin\gas_project\globalvariable.h(15) : error C2146: syntax error : missing ';' before identifier 'oldPoint' 
e:\documents\bin\gas_project\globalvariable.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(16) : error C2146: syntax error : missing ';' before identifier 'oldCir' 
e:\documents\bin\gas_project\globalvariable.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(17) : error C2146: syntax error : missing ';' before identifier 'oldDaGiac' 
e:\documents\bin\gas_project\globalvariable.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(18) : error C2146: syntax error : missing ';' before identifier 'oldObjColor' 
e:\documents\bin\gas_project\globalvariable.h(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
e:\documents\bin\gas_project\globalvariable.h(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
Build log was saved at "file://e:\Documents\BIN\GAS_Project\Debug\BuildLog.htm" 
GAS - 17 error(s), 0 warning(s) 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

しかし、GlobalVariableクラスを削除した後に! Pointクラス、Colorクラス、DaGiacクラス、Circleクラスのみ存在する!それにはエロがありません! 理由を教えてください。そのエラーを中核にする方法は?してください=((それらはGlobalVariableクラスを定義しているので

答えて

2

コンパイラは、他のクラスを「見る」ことができない。そのように、ファイルの末尾に全体GlobalVariableクラスを移動するクラスのすべてのこと

+0

ああハハ.....私はやったことがあります:X:Xクリスはそんなに感謝しています:X:X – Ebizz6996

関連する問題