首页 文章

Visual C编译错误

提问于
浏览
-3

在编译这两个文件时,我遇到了很多错误 . 请帮帮我 .

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; 
);

ERRORS:

-------------------- 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) **

3 回答

  • 1

    似乎PegStripChart未在您向我们展示的任何文件中声明,这似乎至少导致了前几个错误 .

    它是在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

    你正在使用()你应该使用{}的地方

    例如,if-blocks,switch语句,方法声明等 .

相关问题