dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: error C2143 and error C4430 while compiling CPP code

  1. #1
    Join Date
    Mar 2007
    Posts
    1

    error C2143 and error C4430 while compiling CPP code

    When I compile the following piece of code , I get the following errors
    d:\Program Files\Microsoft Visual Studio 8\VC\ce\include\xstring(27) : error C2143: syntax error : missing ';' before 'namespace'
    d:\Program Files\Microsoft Visual Studio 8\VC\ce\include\xstring(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int.
    Any help is highly appreciated

    Thanks


    #include "stdafx.h"
    #include "model.h"
    #include "busobj.h"
    #include "buscomp.h"
    #include <uistr.h>

    #include "bcgeocode.h"

    static BOOL bDebug = FALSE;

    SS_IMPLEMENT_DYNCREATE(CSSBCGeocodeLog,CSSBusComp)

    #ifdef _DEBUG
    #undef THIS_FILE
    static char BASED_CODE THIS_FILE[] = __FILE__;
    #define new DEBUG_NEW
    #endif

    CSSBCGeocodeLog::CSSBCGeocodeLog()
    {
    }

    CSSBCGeocodeLog::~CSSBCGeocodeLog()
    {
    }


    ErrCode CSSBCGeocodeLog::NewRecord(BOOL bInsertBefore,
    BOOL bInternal,
    LPCTSTR pIdValue)

    {
    ErrCode err = OK;
    CSSObject* pErrChild = NULL;
    CSSStringArray errParmArr;
    CSSBusObj* pBusObj = NULL;
    CSSBusComp* pBusComp = NULL;
    CSSService* pService= NULL;
    CCFPropertySet gpsdataOutput;
    CCFPropertySet gpsdataInput;

    CCFPropertySet sfmdataInput;
    CCFPropertySet sfmdataOutput;

    SSstring LatitudeNumber;
    SSstring LongitudeNumber;

    // Call the Business Service Method
    DOCHILD(m_pModel, GetService (SStext("FS Gps Data"), pService));
    DOCHILD (pService, InvokeMethod (SStext("GetGPSData"), gpsdataInput, gpsdataOutput));

    // Get gps data from the output arguments

    gpsdataOutput.GetProperty(SStext("ServiceLatitude"), LatitudeNumber);
    gpsdataOutput.GetProperty(SStext("ServiceLongitude"), LongitudeNumber);

    // Call the Business Component

    DOCHILD (m_pBusObj, GetBusComp (SStext("Employee Geo Code Log"), pBusComp));

    //prepare fields of the Bus Comp

    pBusComp->DeactivateFields ();
    pBusComp->ActivateField (SSText("Service Latitude"));
    pBusComp->ActivateField (SSText("Service Longitude"));
    pBusComp->ActivateField (SSText("Timestamp"));

    // Set the view mode to All so that visibility will not be applied

    DOCHILD (pBusComp, SetViewMode (VIEW_ALL, FALSE));


    // Search for the Employee
    //DOCHILD (pBusComp, SetSearchSpec (SStext("Employee Id"), strEmployeeId));

    DOCHILD (pBusComp, Execute ());
    DOCHILD (pBusComp, Home ());

    //set values for the Bus Comp fields
    if (pBusComp->CheckActiveRow () == OK)
    {
    do
    {
    DO(SetFieldValue(SSText ("Service Latitude"), LatitudeNumber));
    DO(SetFieldValue(SSText ("Service Longitude"), LongitudeNumber));
    } // end of do
    while (pBusComp->NextRecord() == OK);
    } // end of if

    // Send the Latitude and Longitude info to server

    sfmdataInput = gpsdataOutput;

    // Call the method that sends the updated record back to server
    if(!LatitudeNumber.IsEmpty() && !LongitudeNumber.IsEmpty())
    {
    DO (SendLocationData (sfmdataInput, sfmdataOutput) );
    }

    ll_abort:
    if(err != OK)
    {
    SetErrorMsg (err, NULL, NULL);
    pErrChild = NULL;
    }
    SetErrorMsg (err, NULL, NULL);

    return (err);

    } //end CSSFSMapService::NewRecord

    ErrCode SendtLocationData (const CCFPropertySet& inputArgs,
    CCFPropertySet& outputArgs)
    {
    // logic to be written
    }

  2. #2
    Join Date
    May 2006
    Posts
    176
    Quote Originally Posted by mailbhuvi
    When I compile the following piece of code , I get the following errors
    d:\Program Files\Microsoft Visual Studio 8\VC\ce\include\xstring(27) : error C2143: syntax error : missing ';' before 'namespace'
    [...]
    }
    I would suggest ensuring that your source and header files (model.h, buscomp.h, etc.) do not describe a class or structure that does not contain a semicolon at the end. For example, the next declaration produces an error:
    Code:
    class MyClass
    {
    } // ";" required here
    I hope this helps.

  3. #3
    Join Date
    Nov 2003
    Posts
    4,118
    Looks like the infamous precompiled headers bug. Disable cached headers and precompiled headers in your project's settings and rebuild. Also make sure that all your class/struct declarations have a ; at the end as Viorel suggested.
    Danny Kalev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center