CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2001
    Posts
    4

    I need help with Errors...

    Here are the errors for the code below:
    PaCalcDlg.cpp
    D:\Programming\Planetarion Build\PaCalcDlg.cpp(62) : error C2059: syntax error : '>'
    D:\Programming\Planetarion Build\PaCalcDlg.cpp(63) : error C2143: syntax error : missing ';' before '{'
    D:\Programming\Planetarion Build\PaCalcDlg.cpp(69) : error C2065: 'r_percentchance' : undeclared identifier
    D:\Programming\Planetarion Build\PaCalcDlg.cpp(69) : error C2065: 'Scans2' : undeclared identifier


    void CPaCalcDlg::OnOK()
    {
    if(IDC_ROIDS <= 199)
    {
    CString string; //Used to hold the output we are gonna stick int o IDC_STATIC
    double Waveamps2 = GetDlgItemInt(IDC_WAVEAMPS); //Grab the number from IDC_AMPS
    double Roids2 = GetDlgItemInt(IDC_ROIDS);
    double Scans2 = GetDlgItemInt(IDC_SCANS);
    double r_percentchance = (30*(1+(Waveamps2/(Roids2*2))));
    double r_totalroids = r_percentchance/100*Scans2;
    //////////////////////////////////////
    //////////////////////////////////////
    // Point Results
    string.Format("%0.0f", r_percentchance); //use printf style formating with a CString
    SetDlgItemText(IDC_PERCHANCE, string); //Change the value of IDC_STATIC to the result of the equation
    string.Format("%0.0f", r_totalroids);
    SetDlgItemText(IDC_TOTALROIDS, string);
    }
    else if(IDC_ROIDS => 200)
    {
    CString string; //Used to hold the output we are gonna stick int o IDC_STATIC
    double Waveamps3 = GetDlgItemInt(IDC_WAVEAMPS); //Grab the number from IDC_AMPS
    double Roids3 = GetDlgItemInt(IDC_ROIDS);
    double Scans3 = GetDlgItemInt(IDC_SCANS);
    double r_percentchance2 = (30*(Waveamps3/(Roids3*3)));
    double r_totalroids2 = r_percentchance/100*Scans2;
    //////////////////////////////////////
    //////////////////////////////////////
    // Point Results
    string.Format("%0.0f", r_percentchance2); //use printf style formating with a CString
    SetDlgItemText(IDC_PERCHANCE, string); //Change the value of IDC_STATIC to the result of the equation
    string.Format("%0.0f", r_totalroids2);
    SetDlgItemText(IDC_TOTALROIDS, string);
    }
    CDialog::OnOK();
    }



    Here are more errors for the code listed below:
    D:\Programming\Planetarion Build\Planetarion BuildDlg.cpp(289) : error C2065: 'CPaCalcDlg' : undeclared identifier
    D:\Programming\Planetarion Build\Planetarion BuildDlg.cpp(289) : error C2146: syntax error : missing ';' before identifier 'PaCalcD'
    D:\Programming\Planetarion Build\Planetarion BuildDlg.cpp(289) : error C2065: 'PaCalcD' : undeclared identifier
    D:\Programming\Planetarion Build\Planetarion BuildDlg.cpp(290) : error C2228: left of '.DoModal' must have class/struct/union type


    void CPlanetarionBuildDlg::OnRoidcalc()
    {
    CPaCalcDlg PaCalcD;
    PaCalcD.DoModal;
    }




    I am a newbie at this, I tried figuring out these errors for awhile now. But i need help doing it. Thanks in advance!

    BaGGy


  2. #2
    Join Date
    Jun 2001
    Posts
    362

    Re: I need help with Errors...

    One of the errors is you have the line

    else if(IDC_ROIDS => 200)



    it should be

    else if(IDC_ROIDS >= 200)




    Brandon


  3. #3
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: I need help with Errors...

    be sure you include the header file for the class CPa.. class in your Planetarion BuildDlg.cpp file

    Richard


  4. #4
    Join Date
    Jun 2001
    Posts
    362

    Re: I need help with Errors...

    A few more errors.

    all of the errors like "error C2065: 'Scans2' : undeclared identifier"
    are because your defenitions of these variables are inside 'if' statements so these variables are going out of scope (they no longer exist once the if statment is executed). to fix this declare the variables that you need to outside of the 'if' sections of code.

    hope this helps.

    Brandon



  5. #5
    Join Date
    Jul 2001
    Posts
    4

    Re: I need help with Errors...

    Thank you!
    You both helped me greatly, and you helped me improve on my error abilities.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured