Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 741
  • Last Modified:

Porting a project from VC++ 6 to VC++ .NET 2003

Hi  

I am porting a project from VC 6 to VC .NET 2003. While compiling most of the files are giving errors as

 

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2143: syntax error : missing ';' before '('

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2226: syntax error : unexpected type 'size_t'

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(30) : error C2059: syntax error : ')'

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2365: 'new' : redefinition; previous definition was a 'member function'

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2491: 'new' : definition of dllimport data not allowed

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2078: too many initializers

 

This is just a part of the errors I get. However, as you can see, all errors point to the same file ‘xdebug’.

Could anyone throw some light on this and help me?

 

Thanks and regards,

JJ
0
Jeevan Bordoloi
Asked:
Jeevan Bordoloi
  • 4
  • 3
1 Solution
 
AxterCommented:
Hi jjbordoloi,
Make sure you're not using non-standard headers.
The following are non-standard headers, and are not part of the C++ standard, and therefore not portable.
#include <vector.h>
#include <list.h>
#inlcude <iostream.h>

The above headers work for  VC++ 6.0, because it supported them, but VC++ 7.x is more compliant with the C++ standard, and therefore it doesn't support these non-standard headers.

If you have the above headers listed in your code, you should convert them to extensionless headers.
#include <vector>
#include <list>
#inlcude <iostream>

The above headers are part of the C++ standard, and therefore portable to compliant C++ compilers like VC++ 7.x and 8.0


Cheers!
0
 
AxterCommented:
jjbordoloi,
If your code is not using non-standard headers, then please post the code that is giving you compile errors.
0
 
Jeevan BordoloiAuthor Commented:
Hi David ,

Thank you for the reply. However, I have already done what you have suggested.
I have also used ‘Not Using Precompiled Headers’ option in the project settings but to no avail.

Here is the code as well.

#include "stdafx.h"
#include "superspn.h"
#include "superspn.ext"
#include "addpbk.h"
#include "terminal.h"
#include "adddirec.h"
#include "incflow.h"
#include "impactdl.h"
#include "engine.hpp"
#include "usage.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAddPBKDlg dialog

CAddPBKDlg::CAddPBKDlg(CWnd* pParent, const char *Acode)
                    :KeyDialog(CAddPBKDlg::IDD, pParent)
{
      Code = Acode;
      Code.MakeUpper();
      //{{AFX_DATA_INIT(CAddPBKDlg)
            // NOTE: the ClassWizard will add member initialization here
      //}}AFX_DATA_INIT
}

CAddPBKDlg::~CAddPBKDlg()
{
      if(pbkCB)
            delete pbkCB;
      if(pbkDirCB)
            delete pbkDirCB;
}

void CAddPBKDlg::DoDataExchange(CDataExchange* pDX)
{
      CDialog::DoDataExchange(pDX);
      //{{AFX_DATA_MAP(CAddPBKDlg)
            // NOTE: the ClassWizard will add DDX and DDV calls here
      //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddPBKDlg, CDialog)
      //{{AFX_MSG_MAP(CAddPBKDlg)
      ON_BN_CLICKED(IDSAVE, OnSaveButton)
      ON_CBN_SELCHANGE(IDC_TERM_DIRECTIONS_COMBO, OnSelchangeDirections)
      ON_CBN_SELCHANGE(IDC_TERM_BREAKS_COMBO, OnSelchangeBreaks)
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddPBKDlg message handlers

KeyDialog::keyState CAddPBKDlg::IsNewKey(CustomControl *cntl)
{
      if(Code == cntl->GetValue())
            return OLD_KEY;
      return NEW_KEY;
}

void CAddPBKDlg::RestoreKey(CustomControl *cntl)
{
        cntl->SetValue(Code);
}

KeyDialog::errorCode CAddPBKDlg::UpdateKey(CustomControl *)
{
      EnablePBKGroup(FALSE);
      if(!Code.IsEmpty())
      {
            Code.MakeUpper();
            if(((CComboBox *)GetDlgItem(IDC_TERM_CODE_ALLOW_PBK))->FindStringExact(-1, Code) == CB_ERR)
                  return INVALID;
            else
                  ((CComboBox *)GetDlgItem(IDC_TERM_CODE_ALLOW_PBK))->SelectString(-1, Code);
            setClass(ControlWithId(IDC_TERM_CODE_ALLOW_PBK)->GetClass());
            database->addField(ControlWithId(IDC_TERM_CODE_ALLOW_PBK)->GetField(), Code);
            return OK;
      }
      return INCOMPLETE;
}

void CAddPBKDlg::setField(CustomControl *cntl)
{
      if(cntl->GetId() == IDC_TERM_CODE_ALLOW_PBK)
            Code = cntl->GetValue();
}

Regards,
JJ
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
AxterCommented:
>>I have also used ‘Not Using Precompiled Headers’ option in the project settings but to no avail.

If you do that, then you need to remove "stdafx.h" from your code.
0
 
Jeevan BordoloiAuthor Commented:
I have tried all the possible combinations -
"stdafx.h" with and without ‘Not Using Precompiled Headers’
and commenting out "stdafx.h" with both ‘Using/ Not Using Precompiled Headers’ options.

Regards,
JJ
0
 
DanRollinsCommented:
From my research, this can be related to the line

     #define new DEBUG_NEW

that is usually at the top of an MFC generated source file.   The standard pre-amble normally looks like this:

=-=-=-=--=-==-=-=-=-=-=-=-==
#include "stdafx.h"
#include ...etc...

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

Since the source code you posted did not include that line, it would be worth a try to add it as shown.  Do a Clean and Rebuild.  

Also check this out:
   Debug errors in VC++ .NET (xdebug)
   http://www.developmentnow.com/g/54_2005_3_0_0_287984/Debug-errors-in-VC-NET-xdebug.htm
where the author seems to think it relates to
    #include <fstream>
and
   using namespace std

-- Dan
0
 
Jeevan BordoloiAuthor Commented:
>>Also check this out:
>>   Debug errors in VC++ .NET (xdebug)
>>   http://www.developmentnow.com/g/54_2005_3_0_0_287984/Debug-errors-in-VC-NET-xdebug.htm
>>where the author seems to think it relates to
>>    #include <fstream>
>>and
>>   using namespace std

This part worked. Thank you.
0
 
AxterCommented:
jjbordoloi,
Why the B grade for a 50 question?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now