2009-10-15 151 views
-3

編譯這兩個文件時,我收到許多錯誤。請幫助我。Visual C++編譯錯誤

stchart.cpp

# include "peg.hpp" 
# include "stchart.hpp" 
# include "stchart_res.hpp" 

external PegResourceTable stchart_ResourceTable; 

PEGINT gChartData [] = (100, 100, 100, 100, 100, 100, 125, 150, 175, 200, 
         150, 100, 50, 100, 125, 100, 100, 100); 

PEGINT gBukData [] = (100, 100, 100, 100, 100, 100, 100, 100, 125, 100, 
         100, 120, 140, 160, 180, 200, 150, 100, 50, 125, 100, 
         100, 125, 150, 125, 100, 100, 100, 100); 


/*------------------------------------------------ --------------------------*/ 
/*------------------------------------------------ --------------------------*/ 
Strip Chart Window:: Window Strip Chart (PegRect const Rect &, 
              const PEGUINT titleid): 
           PegDecoratedWindow (Rect) 
( 
    PEGCOLOR tempColor1, tempColor2, tempColor3; 
    if (titleid) 
    ( 
     Add (new PegTitle (titleid)); 
    ) 

    PegRect Chart mClient = Rect; 
    ChartRect.Bottom = mClient.Height()/2 to 2; 
    mpChart = new PegStripChart (Chart Rect, 130, -100, 700, 10, 100); 
    mpChart-> SetExStyle (mpChart-> GetExStyle() | CS_DRAWYGRID | 
         CS_DRAWXGRID | CS_DRAWXTICS | CS_DRAWYLABELS | 
         CS_SCROLLED |// CS_DUALYTICS | CS_DRAWLINEFILL | 
         CS_DRAWXLABELS | CS_DUALYTICS | CS_DRAWXLABELS | 
         CS_DUALYLABELS); 
    mpChart-> SetExStyle (mpChart-> GetExStyle() & ~ CS_PAGED); 
    Add (mpChart); 
    tempColor1 = PegResourceManager:: GetColor (CID_CYAN); 
    tempColor2 = PegResourceManager:: GetColor (CID_BLUE); 
    tempColor3 = PegResourceManager:: GetColor (CID_MAGENTA); 
    mSin = mpChart-> AddLine (tempColor1, tempColor1, tempColor3); 

    tempColor1 = PegResourceManager:: GetColor (CID_LIGHTGREEN); 
    tempColor2 = PegResourceManager:: GetColor (CID_GREEN); 
    tempColor3 = PegResourceManager:: GetColor (CID_RED); 
    MID-mpChart => AddLine (tempColor1, tempColor1, tempColor3); 
    mpChart-> SetYLabelScale (200); 

    ChartRect.Top = ChartRect.Bottom + 4; 
    ChartRect.Bottom = mClient.Bottom; 
    mpChart2 = new PegStripChart (Chart Rect, 130, -200, 600, 10, 100); 
    mpChart2-> SetExStyle (mpChart2-> GetExStyle() | CS_DRAWAGED | 
         CS_XAXISONZEROY | CS_DRAWXTICS | CS_DRAWXLABELS); 
         // CS_DRAWLINEFILL); 

    Add (mpChart2); 
    tempColor1 = PegResourceManager:: GetColor (CID_LIGHTBLUE); 
    tempColor2 = PegResourceManager:: GetColor (CID_BLUE); 
    tempColor3 = PegResourceManager:: GetColor (CID_CYAN); 
    mSin2 = mpChart2-> AddLine (tempColor1, tempColor1, tempColor3); 

    tempColor1 = PegResourceManager:: GetColor (CID_LIGHTGREEN); 
    tempColor2 = PegResourceManager:: GetColor (CID_GREEN); 
    tempColor3 = PegResourceManager:: GetColor (CID_GREEN); 
    mID2 = mpChart2-> AddLine (tempColor1, tempColor1, tempColor3); 

) 

/*------------------------------------------------ --------------------------*/ 
/*------------------------------------------------ --------------------------*/ 
PEGINT Strip Chart Window:: Message (const PegMessage & mesg) 
( 
    static PEGINT Index = 0, j = 0; 
    static PEGINT Angle = 0; 

    switch (Mesg.Type) 
    ( 
    PM_SHOW case: 
     PegWindow:: Message (mesg); 
     SetTimer (1, PEG_ONE_SECOND, 1); 
     break; 

    PM_HIDE case: 
     PegWindow:: Message (mesg); 
     Kill Timer (1); 
     break; 

    PM_TIMER case: 
     ( 
      if (+ + index> 17) 
      ( 
       Index = 0; 
      ) 

      mpChart-> AddData (MID, gChartData [Index]); 

      if (+ + j> 28) 
      ( 
       j = 0; 
      ) 
      mpChart2-> AddData (mID2, gBukData [j]); 

      if ((Angle + = 10)> 350) 
      ( 
       Angle = 0; 
      ) 

      PEGINT Sin, Cos; 
      PegLookupSinCos (Angle, & Sin, Cos &); 
      mpChart-> AddData (mSin, (PEGLONG) ((Sin * 125)>> 10) + 400); 
      mpChart2-> AddData (mSin2, (PEGLONG) ((125 * Cos)>> 10) + 400); 
     ) 

    default: 
     ( 
      return (PegWindow:: Message (mesg)); 
     ) 
    ) 

    return 0; 
) 

/*------------------------------------------------ --------------------------*/ 
/*------------------------------------------------ --------------------------*/ 
void PegAppInitialize (PegPresentationManager * pPresentation) 
( 
    PegRect Rect; 
    Rect.Set (10, 10, 630, 470); 

    PegResourceManager:: Install Resources From Table (& 
                stchart_ResourceTable); 
    Strip Chart Window * pWindow = new Strip Chart Window (Rect, SID_TITLE); 
    pPresentation-> Add (pWindow); 


) 

stchart.hpp:

Strip Chart class Window: public PegDecoratedWindow 
( 
    public: 
     Strip Chart Window (PegRect const Rect &, const PEGUINT titleid); 
     Strip Chart virtual ~ Window()() 

     virtual PEGINT Message (const PegMessage & mesg); 

    public: 
PegStripChart * mpChart; 
PegStripChart * mpChart2; 

     PEGUBYTE mid; 
     PEGUBYTE mSin; 
     PEGUBYTE mID2; 
     PEGUBYTE mSin2; 
); 

錯誤:

 
    -------------------- Configuration: stchart - Win32 Debug -------------------- 
    Compiling ... 
    stchart.cpp 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (29): error C2143: syntax error: missing ',' before '*' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (29): error C2501: 'PegStripChart': missing storage-class or type specifiers 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (29): error C2501: 'mpChart': missing storage-class or type specifiers 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (30): error C2143: syntax error: missing ',' before '*' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (30): error C2501: 'PegStripChart': missing storage-class or type specifiers 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.hpp (30): error C2501: 'mpChart2': missing storage-class or type specifiers 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (45): error C2065: 'mpChart': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (45): error C2061: syntax error: identifier 'PegStripChart' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2227: left of '-> SetExStyle' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2227: left of '-> GetExStyle' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2065: 'CS_DRAWYGRID': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (46): error C2065: 'CS_DRAWXGRID': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (47): error C2065: 'CS_DRAWXTICS': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (47): error C2065: 'CS_DRAWYLABELS': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (47): error C2065: 'CS_SCROLLED': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (49): error C2065: 'CS_DUALYTICS': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (49): error C2065: 'CS_DRAWXLABELS': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (50): error C2065: 'CS_DUALYLABELS': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (51): error C2227: left of '-> SetExStyle' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (51): error C2227: left of '-> GetExStyle' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (51): error C2065: 'CS_PAGED': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (56): error C2227: left of '-> AddLine' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (61): error C2227: left of '-> AddLine' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (62): error C2227: left of '-> SetYLabelScale' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (66): error C2065: 'mpChart2': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (66): error C2061: syntax error: identifier 'PegStripChart' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (67): error C2227: left of '-> SetExStyle' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (67): error C2227: left of '-> GetExStyle' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (67): error C2065: 'CS_DRAWAGED': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (68): error C2065: 'CS_XAXISONZEROY': undeclared identifier 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (75): error C2227: left of '-> AddLine' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (80): error C2227: left of '-> AddLine' must point to class/struct/union 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): error C2143: syntax error: missing ',' before ')' 
    c: \ swellsoftware \ pegplus \ examples \ stchart \ plus \ stchart.cpp (82): fatal error C1003: error count exceeds 100; stopping compilation 
    Error executing cl.exe. 

    ** stchart.obj - 102 error (s), 0 warning (s) ** 
+1

考慮重新格式化您的帖子,它是不可讀的。 – 2009-10-15 06:47:51

+0

注意重新格式化(縮進右邊的整個混亂)並至少指定「line 29」,「line 82」等在哪裏。 – 2009-10-15 06:47:55

+0

什麼是ChartRect.Bottom = mClient.Height()/ 2 2;'? (到2?) – Naveen 2009-10-15 06:53:49

回答

1

看來,Pe的gStripChart沒有在您向我們顯示的任何文件中聲明,這似乎至少會導致前幾個錯誤。

它是在peg.hpp中聲明的嗎?在你的開關操作

1

注重它應該是:

switch (Mesg.Type) 
( 
    case PM_SHOW: 
    PegWindow:: Message (mesg); 
    SetTimer (1, PEG_ONE_SECOND, 1); 
    break; 

    case PM_HIDE: 
    PegWindow:: Message (mesg); 
    Kill Timer (1); 
    break; 
............................. 
............................. 

And you wrote: 

switch (Mesg.Type) 
( 
    PM_SHOW case : 
    PegWindow:: Message (mesg); 
    SetTimer (1, PEG_ONE_SECOND, 1); 
    break; 

    PM_HIDE case : 
    PegWindow:: Message (mesg); 
    Kill Timer (1); 
    break; 

........................ .... .................

0

您正在使用()的,你應該使用{}的

例如,你如果塊,switch語句,方法聲明等。