Solved

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

Posted on 2006-06-21
8
735 Views
Last Modified: 2008-02-01
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
Comment
Question by:Jeevan Bordoloi
  • 4
  • 3
8 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 16957359
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
 
LVL 30

Expert Comment

by:Axter
ID: 16957365
jjbordoloi,
If your code is not using non-standard headers, then please post the code that is giving you compile errors.
0
 
LVL 3

Author Comment

by:Jeevan Bordoloi
ID: 16958311
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.

 
LVL 30

Expert Comment

by:Axter
ID: 16958746
>>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
 
LVL 3

Author Comment

by:Jeevan Bordoloi
ID: 16959069
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
 
LVL 49

Accepted Solution

by:
DanRollins earned 50 total points
ID: 16972934
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
 
LVL 3

Author Comment

by:Jeevan Bordoloi
ID: 16991029
>>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
 
LVL 30

Expert Comment

by:Axter
ID: 16991049
jjbordoloi,
Why the B grade for a 50 question?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Deploying with installshield 1 376
memorymap in visual studio 3 69
SSIS Script Task pick up the latest CSV file 4 150
mixing C++ & C# in Vis Studio 2013 7 239
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question