error C2065: undeclared identifier

After rebuilding my development computer as XP Pro (instead of Win2k) using Visual C++ 6.0 with the Microsoft C++ 2005 Redistributable installed,  I'm trying to recompile code that always used to compile. Now though I'm getting these errors:

error C2065: '_tcscat_instead_use_StringCbCat_or_StringCchCat' : undeclared identifier
error C2065: '_tcscpy_instead_use_StringCbCopy_or_StringCchCopy' : undeclared identifier
error C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared identifier
error C2065: '_stprintf_instead_use_StringCbPrintf_or_StringCchPrintf' : undeclared identifier
error C2065: 'strcpy_instead_use_StringCbCopyA_or_StringCchCopyA' : undeclared identifier

What might be wrong?

thanks
PMH4514Asked:
Who is Participating?
 
jkrCommented:
Set

#undef STRSAFE_NO_DEPRECATE
#define DEPRECATE_SUPPORTED

before including any SDK headers.
0
 
Infinity08Commented:
Those are pretty weird identifiers :

        _tcscat_instead_use_StringCbCat_or_StringCchCat

I assume that you have to replace that with either StringCbCat or StringCchCat.
0
 
NovaDenizenCommented:
Somebody has decided that you shouldn't be using the tcscat, tcscpy, sprintf or strcpy functions.  They went into your header files and replaced the definitions of these functions with big long nonexistent identifiers like _tcscat_instead_use_StringCbCat_or_StringCchCat that cause compile and/or linking errors.  

The best way to deal with this is probably to rewrite your code to use the StringCbCat and StringCchCat functions instead of the other functions that are denied to you.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
jkrCommented:
BTW, check out the file "PlatformSDK\Include\strsafe.h" which is responsible for that strange name mapping.
0
 
Infinity08Commented:
>> BTW, check out the file "PlatformSDK\Include\strsafe.h" which is responsible for that strange name mapping.

Wow, I wonder who came up with this idea ... It's a pretty weird way of reporting a deprecated method.
0
 
jkrCommented:
The new PSDK tries to force you to use the safety-improved (non standard!) versions of their string functions. But, that simply is not possible without VC++ 8.
0
 
itsmeandnobodyelseCommented:
>>>> using Visual C++ 6.0 with the Microsoft C++ 2005 Redistributable installed,
You are using some wrong include folders for VC6. I assume you are using the new platform sdk. That comes if you installed VC6 after the new SDK and so have the SDK folders as 'default' include and library project folders in the settings at 'Tools - Options - Directories'. I would strongly recommend to remove them (the new SDK folders) from there cause you may experience other incompatibilities if you do not.

Note, if you build from the command line you also must check the 'include' and 'lib' environment variable, which may contain the folders as well. You have to make them switchable in that case.

Regards, Alex
0
 
PMH4514Author Commented:
Hmm.. For reference, this is the actual code that it's complaining on:

      _tcscat( m_lpszUIProductName, PRODUCT_NAME );
    _tcscpy( m_lpszUIVersion, PRODUCT_SYMBOLS );
      _tcscat( m_lpszUIVersion, PRODUCT_VERSION );
      _tcscat( m_lpszUIVersion, SERVICE_PACK );
    _tcscat( m_lpszUIVersion, BUILD );
    _tcscat( m_lpszUIVersion, EXTENSION );
    _tcscat( m_lpszReleaseDate, RELEASE_DATE );
    _tcscat( m_lpszBuildDate, BUILD_DATE );
    _tcscat( m_lpszSchema, SCHEMA );


each of those constants is just a definition like this:

#define PRODUCT_NAME _T("MyApp")

When I rebuild my development computer I installed the Platform SDK first, and then VC++ 6.0

When I remove the include/library folders from the project settings for the platform SDK and try to recompile, I get this error:

fatal error C1083: Cannot open include file: 'Qedit.h': No such file or directory

Again, this did all used to work just fine before I rebuilt my dev computer.



0
 
jkrCommented:
So, do you have both VC6 and VC8 installed or just VC6 with a newer PSDK? If the latter applies, try my suggestion above.
0
 
itsmeandnobodyelseCommented:
>>>> fatal error C1083: Cannot open include file: 'Qedit.h':
The qedit.h is a file that didn't come with VC6 but with the platform sdk. You would need to install an older version of the platform sdk (best copy the folders from a machine where the old sdk was installed) and add the include and library path to the directories settings in VC6.

Note, you could try to get it working using the newer SDK, but I really recomemnd against. VC6 and VC8 have no much in common and the were developed by different teams who didn't much look for compatibility. I know cause we ported a huge system from VC6 to VC8 and we ever failed when not strictly separating the development environments.
0
 
PMH4514Author Commented:
I am pretty certain I installed the platform SDK from the same installer that I had previously used.  I did not locate and download a new version.  I only have VC6 installed. How can I determine the version of the Platform SDK?
0
 
PMH4514Author Commented:
.. additionally - another of our developers has no problem compiling the same code. If I were to merely copy the entire contents of her "\Microsoft Platform SDK" folder overwriting my folder of the same name, would that effectively replace my version with the version that works? Or are other things installed into the OS?
0
 
PMH4514Author Commented:
I overwrote the contents of my Microsoft Platform SDK folder with the contents of the same folder from another developer's computer, one on which the code compiles without error.

I still get errors. Not all of them, a shorter list:

_tcscat( m_lpszUIProductName, PRODUCT_NAME );
_tcscpy( m_lpszUIVersion, PRODUCT_SYMBOLS );
sprintf(m_lpszStandardFontBold, "%s Bold", m_lpszStandardFont);
_stprintf(lpszBuffer, _T("%d"), a_iPower);
strcpy(m_lpszLocalDBPath, m_lpszDefaultDBPath);


0
 
PMH4514Author Commented:
woops, forgive that last post.. It should read:
------------------
error C2065: '_tcscat_instead_use_StringCbCat_or_StringCchCat' : undeclared identifier
error C2065: '_tcscpy_instead_use_StringCbCopy_or_StringCchCopy' : undeclared identifier
error C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared identifier
error C2065: '_stprintf_instead_use_StringCbPrintf_or_StringCchPrintf' : undeclared identifier
error C2065: 'strcpy_instead_use_StringCbCopyA_or_StringCchCopyA' : undeclared identifier


on these lines:

_tcscat( m_lpszUIProductName, PRODUCT_NAME );
_tcscpy( m_lpszUIVersion, PRODUCT_SYMBOLS );
sprintf(m_lpszStandardFontBold, "%s Bold", m_lpszStandardFont);
_stprintf(lpszBuffer, _T("%d"), a_iPower);
strcpy(m_lpszLocalDBPath, m_lpszDefaultDBPath);
0
 
PMH4514Author Commented:
JKR Wrote: "BTW, check out the file "PlatformSDK\Include\strsafe.h" which is responsible for that strange name mapping."

I looked into that file, and determined from it that I could add this line to stdafx.h

#define STRSAFE_NO_DEPRECATE

and the compile succeeds.

But have I opened up a can of worms by doing so?
0
 
jkrCommented:
Actually, it should be the other way round (as above). Strange...
0
 
PMH4514Author Commented:
yah, I noticed that.. I had originally missed your first comment (the one I accepted)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.