Error c2061: syntax error: identifier ‘this_ FILE’





… error C2061: syntax error : identifier ‘THIS_FILE’
… /new(35) : error C2091: function returns function
… /new(35) : error C2809: ‘operator new’ has no formal parameters
… /new(36) : error C2061: syntax error : identifier ‘THIS_FILE’
… /new(37) : error C2091: function returns function
very strange, yesterday this class has been tested, no problem, look up the Internet, finally found the problem.
Solutions:

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__!
#endif
#include “selectserver. h”
search, found these errors were related to the STL header file and VC6 generated in the CPP file, the STL header file is the following lines:
#pragma warning (disable:4786)
#include < list>
using namespace std;
The lines of code generated by VC6 in the CPP file are the following:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
STL header file to be written in the VC6 generated in the CPP file a few lines of code, remember! My “selectServer.h” file contains the STL header, so when you include” selectServer.h “in any other CPP file, be sure to include the #include” selectServer.h” in front of the lines of code that VC6 generates! So let’s change it to the following so that it compiles.
#include “SelectServer.h”
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Conclusion in
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Do not write #include after the introduction file error-prone move #include statements to the front of the paragraph


Read More: