CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    20

    Unhappy Many errors and I don't know why?

    Hi all,

    I have many compilation errors in my solutions and the type of errors are very different.

    I am developing an MFC dialog application with visual studio 2005 and the follwoing is one of my work and with eash file I am adding the errors generated with each file.



    // ( RulesMatching.h )


    #ifndef RULESMATCHING_HEADER_ID
    #define RULESMATCHING_HEADER_ID


    #include "PatternMatching.h"


    class CRulesMatching
    {
    public:
    CRulesMatching();
    int MatchRule(CString,int);

    CPatternMatching OPM2; // create object OPM2 from the class
    }

    #endif



    // ( RulesMatching.cpp )

    #include "stdafx.h"
    #include "RulesMatching.h"
    #include "afxdb.h"
    #include "odbcinst.h"


    CRulesMatching::CRulesMatching()
    {

    }

    int CRulesMatching::MatchRule(CString Str, int Cnum)
    {


    CDatabase database4;
    CString SqlRulePattern;

    CString sDriver("MICROSOFT ACCESS DRIVER (*.mdb)");
    CString sDsn;
    CString ssDSN("ODBC;DRIVER={%s};DSN='';DBQ=%s");
    CString sFile("d:\\works\\ReadDB\\ASU.mdb");

    sDsn.Format(ssDSN, sDriver, sFile);

    database4.Open(NULL,false,false,sDsn);

    CRecordset recset2( &database4 );


    SqlRulePattern= "SELECT * from Patterns where CNum="+Cnum ;


    recset2.Open(CRecordset::forwardOnly,SqlRulePattern,CRecordset::readOnly);
    int Result2;
    CString RContextNum,RRuleNum,RPatternNum,RPatternValue,RPatternContent;
    CString BestRContextNum,BestRRuleNum,BestRPatternNum;

    while(!recset2.IsEOF())
    {
    recset2.GetFieldValue(_T("CNum"),RContextNum);
    recset2.GetFieldValue(_T("RNum"),RRuleNum);
    recset2.GetFieldValue(_T("PNum"),RPatternNum);
    recset2.GetFieldValue(_T("PValue"),RPatternValue);
    recset2.GetFieldValue(_T("PContent"),RPatternContent);

    Result2 = OPM2.MatchPattern(Str,RPatternContent);
    if (Result2==1)
    {
    BestRContextNum = RContextNum;
    BestRRuleNum = RRuleNum;
    BestRPatternNum = RPatternNum;
    recset2.MoveNext();
    }

    else
    {
    recset2.MoveNext();
    }

    }// while() closing



    int i = _ttoi(BestRRuleNum);

    return i ;





    }



    WHEN I COMPILE THE PREVIOUS ( .cpp file ) I HAD THESE ERRORS:


    sqltypes.h(21) : error C2143: syntax error : missing ';' before 'string'
    sqltypes.h(21) : error C2059: syntax error : 'string'
    sqltypes.h(21) : error C2143: syntax error : missing ';' before '{'
    sqltypes.h(21) : error C2447: '{' : missing function header (old-style formal list?)
    afxdb_.h(70) : error C2146: syntax error : missing ';' before identifier 'm_dwDataLength'
    afxdb_.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    afxdb_.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    sql.h(578) : error C2143: syntax error : missing ';' before '__stdcall'
    sql.h(578) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    sql.h(578) : error C2065: 'SQLHENV' : undeclared identifier
    sql.h(578) : error C2146: syntax error : missing ')' before identifier 'EnvironmentHandle'
    sql.h(578) : warning C4229: anachronism used : modifiers on data are ignored
    sql.h(578) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    sql.h(579) : error C2059: syntax error : ')'
    sql.h(581) : error C2143: syntax error : missing ';' before '__stdcall'
    sql.h(581) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    sql.h(581) : error C2086: 'int SQLRETURN' : redefinition
    sql.h(578) : see declaration of 'SQLRETURN'
    sql.h(581) : error C2065: 'EnvironmentHandle' : undeclared identifier
    warning C4229: anachronism used : modifiers on data are ignored
    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    sql.h(581) : fatal error C1903: unable to recover from previous error(s); stopping compilation

    ACA - 19 error(s), 2 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



    AND WHEN I COMPILE THE WHOLE SOLUTION I HAVE THESE ERRORS:



    error C2236: unexpected 'class' 'CUtteranceCleaning'. Did you forget a ';'?
    c:\documents and settings\mohammad\desktop\aca\aca\utterancecleaning.h(5) : error C2143: syntax error : missing ';' before '{'
    c:\documents and settings\mohammad\desktop\aca\aca\utterancecleaning.h(5) : error C2447: '{' : missing function header (old-style formal list?)
    c:\documents and settings\mohammad\desktop\aca\aca\acadlg.h(31) : error C2146: syntax error : missing ';' before identifier 'OUC'
    acadlg.h(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    \acadlg.h(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    acadlg.cpp(169) : error C2065: 'OUC' : undeclared identifier
    acadlg.cpp(169) : error C2228: left of '.CleanUtterance' must have class/struct/union
    type is ''unknown-type''
    Build log was saved at "file://c:\Documents and Settings\mohammad\Desktop\ACA\ACA\Debug\BuildLog.htm"
    ACA - 8 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    I am sorry for this long thread but I worked for two days to make the solution working and I can't .

    Please anyone can help me let me know and I appreciate any type of helping.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Many errors and I don't know why?

    Most of these errors are in header files. Hence you'll have to show us those (if they're yours) or where you're including them (if they're not).

    error C2236: unexpected 'class' 'CUtteranceCleaning'. Did you forget a ';'?
    This one at least should be self-explanatory---you probably forgot to close a class or struct definition with a ; after the closing }.

  3. #3
    Join Date
    Jan 2009
    Posts
    20

    Re: Many errors and I don't know why?

    I can't believe that I spend two days to search about the problem and finally the problem was with like you said semicolon

    Thank you very much

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