Problem porting V6 C++ Project to .NET

  • Thread starter Thread starter Rob C
  • Start date Start date
R

Rob C

I am rebuilding a VC++ w/ MFC Project from Visual Studio
V6 in Visual Studio .NET 2003.

There are 2 errors that I am getting that I do not get
when I build using V6.

1) problem with my declaration of a static fuction.

I have a static function called GetDocID() that returns a
CString.

in my .h file it is declared:

static CString GetDocID() { return _T("10010"); }

in the .CPP file, I have declared at the top of the file:

CString CCMSMDSAssessmentMgr::GetDocID();

The error message I am getting is:

"Member Function redeclaration not allowed"

Why was the syntax OK in VS V6 but not in VS .NET? What
is the proper syntax for declaring a member function as
static?

2) GetDefaultPrinter "Identifier Not Found"

I use the SDK function GetDefaultPrinter &
SetDefaultPrinter. I am assuming that I have the right
version of the SDK

installed because this builds OK with VC++ V6. Any ideas
what I need to do here?

Thanks for your help.

Regards,

-Rob
 
Rob C said:
[...]
in my .h file it is declared:

static CString GetDocID() { return _T("10010"); }

in the .CPP file, I have declared at the top of the file:

CString CCMSMDSAssessmentMgr::GetDocID();

Why? I have never seen this.
The error message I am getting is:

"Member Function redeclaration not allowed"

Fine. The compiler catches this error.
Why was the syntax OK in VS V6 but not in VS .NET?

I dunno why was it allowed in VC6. Maybe
a bug? I don't think it's std conform to
declare a class member like this, so I'm
fine with the new compiler disallowing it.
(Meybe you confuse this with the need to
_define_ static data members?)
What
is the proper syntax for declaring a member function as
static?

As you did:
static CString GetDocID();
2) GetDefaultPrinter "Identifier Not Found"

I use the SDK function GetDefaultPrinter &
SetDefaultPrinter. I am assuming that I have the right
version of the SDK

installed because this builds OK with VC++ V6. Any ideas
what I need to do here?

My browser finds it in "winspool.h", the
help says "Declared in Winspool.h; include
Windows.h".
Thanks for your help.
HTH!

Regards,

-Rob


Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers org

"And why should I know better by now/When I'm old enough not to?"
Beth Orton
 
Rob C said:
[...]
I also did an include of winspool.h and then it complied.

I still find it odd hat I did not have to do this when
building under VC V6.

Probably one of the std lib headers
pulled said:
Regards,

-Rob
[...]

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers org

"And why should I know better by now/When I'm old enough not to?"
Beth Orton
 
Back
Top