Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error preprocessor directives when building

When building a VS2013 solution (migrated from VS8) I get the following error :

Error 1 error C2220: warning treated as error - no 'object' file generated C:\Program Files\Microsoft Visual Studio 12.0\VC\atlmfc\include\afx.h 38 Warning 2 warning C4996: 'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may be removed in a future version of MFC. C:\Program Files\Microsoft Visual Studio 12.0\VC\atlmfc\include\afx.h 38

This is caused bij the following code :

    #ifdef _MBCS
// Warn about MBCS support being deprecated: see http://go.microsoft.com/fwlink/p/?LinkId=279048 for more information.
#pragma warning(push)
#pragma warning(1 : 4996)
inline __declspec(deprecated("MBCS support in MFC is deprecated and may be removed in a future version of MFC.")) void MBCS_Support_Deprecated_In_MFC() { }

class MBCS_Deprecated_MFC
{
public:
    MBCS_Deprecated_MFC() { MBCS_Support_Deprecated_In_MFC(); }
};
#pragma warning(pop)
#endif

How can I find where _MBCS is defined in the solution. Find doesn't has any results.

like image 397
pistach Avatar asked Jan 11 '23 15:01

pistach


1 Answers

The _MBCS symbol will be defined as a result of the settings in your project properties. Look at General->Character Set - this is what adds the required entries to the command line.

To continue using MBCS, you need to install the optional support from Microsoft here

As it notes in MSDN:

msdn

The code in your question actually gives a link to this blog post, which discusses the changes and includes a link to the download:

// Warn about MBCS support being deprecated: see http://go.microsoft.com/fwlink/p/?LinkId=279048 for more information.

So, you can either download the patch from the link above or migrate your application to UNICODE.

like image 155
Roger Rowland Avatar answered Jan 23 '23 02:01

Roger Rowland