G
Guest
I imported a VC++6.0 project into VC++7.1. The conversion operation makes a mess with Preprocessor Definitions, adding a "$(NoInherit)" for each file.
For example: I had a DLL project in VC++6.0 where the definitions were:
_UNICODE,_DEBUG,_WIN32_DCOM,WIN32,_WINDOWS,_WINDLL,_AFXDLL,_USRDLL
In VC++7.1, these are the preprocessor definitions of the project (right-click the project in Solution Explorer and choose Properties -> C++ -> Preprocessor):
_DEBUG;_WIN32_DCOM;WIN32;_WINDOWS;_USRDLL
And the following are the preprocessor definitions of the .cpp files:
_UNICODE;_DEBUG;_WIN32_DCOM;WIN32;_WINDOWS;_WINDLL;_AFXDLL;_USRDLL;$(NoInherit)
Note that _UNICODE, _WINDLL and _AFXDLL have disappeared from the main project settings... I wonder why.
Is there a way to change this irritating behaviour? I'd like the source file to share settings as in VC++6.0.
If the only way is to fix it manually, shall I simply remove $(NoInherit) from each .cpp file, or add $(Inherit) ?
Furthermore, when I add a new source file to the project, its "preprocessor definition" text box is empty, and clicking on the "(...)" button I see (in the "preprocessor definition" dialog) that the checkbox "Inherit from project" is checked by default, and that the "inherited" preprocessor definitions are:
_DEBUG
_WIN32_DCOM
WIN32
_WINDOWS
_USRDLL
_WINDLL
_AFXDLL
_UNICODE
UNICODE
Note that this time we have _UNICODE, _WINDLL and _AFXDLL again, but we have also UNICODE without underscore (I read on a newsgroup that "The _UNICODE macro is used for the C run-time header files, and the UNICODE macro is used for the Win32 header files"). But where do these four phantom preprocessor definition come from?
If I compile the new .cpp file, I get a compiler warning (placed at the line where I include "StdAfx.h"):
warning C4005: 'UNICODE' : macro redefinition
d:\Programs\VisualStudio2003\Vc7\atlmfc\include\afxv_w32.h(123) : see previous definition of 'UNICODE'
The "previous definition" refers to the following lines of "afxv_w32.h"
#ifdef _UNICODE
#ifndef UNICODE
#define UNICODE // UNICODE is used by Windows headers
#endif
#endif
Another post on a newsgroup says, "All you need to do is define _UNICODE. The Microsoft headers automatically define UNICODE for you if _UNICODE has been defined."
But I didn't define UNICODE, it seems to appear from thin air... Can this "double definition" be a problem? How can avoid the warning?
Note that the "General -> Character Set" option has been set automatically to "Use Unicode Character Set".
Thank you very much
Paolo
For example: I had a DLL project in VC++6.0 where the definitions were:
_UNICODE,_DEBUG,_WIN32_DCOM,WIN32,_WINDOWS,_WINDLL,_AFXDLL,_USRDLL
In VC++7.1, these are the preprocessor definitions of the project (right-click the project in Solution Explorer and choose Properties -> C++ -> Preprocessor):
_DEBUG;_WIN32_DCOM;WIN32;_WINDOWS;_USRDLL
And the following are the preprocessor definitions of the .cpp files:
_UNICODE;_DEBUG;_WIN32_DCOM;WIN32;_WINDOWS;_WINDLL;_AFXDLL;_USRDLL;$(NoInherit)
Note that _UNICODE, _WINDLL and _AFXDLL have disappeared from the main project settings... I wonder why.
Is there a way to change this irritating behaviour? I'd like the source file to share settings as in VC++6.0.
If the only way is to fix it manually, shall I simply remove $(NoInherit) from each .cpp file, or add $(Inherit) ?
Furthermore, when I add a new source file to the project, its "preprocessor definition" text box is empty, and clicking on the "(...)" button I see (in the "preprocessor definition" dialog) that the checkbox "Inherit from project" is checked by default, and that the "inherited" preprocessor definitions are:
_DEBUG
_WIN32_DCOM
WIN32
_WINDOWS
_USRDLL
_WINDLL
_AFXDLL
_UNICODE
UNICODE
Note that this time we have _UNICODE, _WINDLL and _AFXDLL again, but we have also UNICODE without underscore (I read on a newsgroup that "The _UNICODE macro is used for the C run-time header files, and the UNICODE macro is used for the Win32 header files"). But where do these four phantom preprocessor definition come from?
If I compile the new .cpp file, I get a compiler warning (placed at the line where I include "StdAfx.h"):
warning C4005: 'UNICODE' : macro redefinition
d:\Programs\VisualStudio2003\Vc7\atlmfc\include\afxv_w32.h(123) : see previous definition of 'UNICODE'
The "previous definition" refers to the following lines of "afxv_w32.h"
#ifdef _UNICODE
#ifndef UNICODE
#define UNICODE // UNICODE is used by Windows headers
#endif
#endif
Another post on a newsgroup says, "All you need to do is define _UNICODE. The Microsoft headers automatically define UNICODE for you if _UNICODE has been defined."
But I didn't define UNICODE, it seems to appear from thin air... Can this "double definition" be a problem? How can avoid the warning?
Note that the "General -> Character Set" option has been set automatically to "Use Unicode Character Set".
Thank you very much
Paolo