How to solve this compiler error.
-
Dear Programmers, I converted a linux code to vc++ MFC app(VS2012), compiler generating this error on compilation:- 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\cstdio(39): error C2039: 'fclose' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\cstdio(39): error C2873: 'fclose' : symbol cannot be used in a using-declaration. Though have tried several setting changes, but this error is upsetting. Any help would be highly appreciated. -Pankaj
-
Dear Programmers, I converted a linux code to vc++ MFC app(VS2012), compiler generating this error on compilation:- 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\cstdio(39): error C2039: 'fclose' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\cstdio(39): error C2873: 'fclose' : symbol cannot be used in a using-declaration. Though have tried several setting changes, but this error is upsetting. Any help would be highly appreciated. -Pankaj
This may occur when the source file is compiled as C. If it is a plain C file (.c) you should not include cstdio but stdio.h. If it is a C++ file (or should be compiled as such), set the appropriate option in the project settings (I have no VS21012 here but it should be at "C/C++ - Advanced" - "Compile As") to compile all files as C++, or rename source files to .cpp.
-
Dear Programmers, I converted a linux code to vc++ MFC app(VS2012), compiler generating this error on compilation:- 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\cstdio(39): error C2039: 'fclose' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\cstdio(39): error C2873: 'fclose' : symbol cannot be used in a using-declaration. Though have tried several setting changes, but this error is upsetting. Any help would be highly appreciated. -Pankaj
Unfortunately you haven't shown the code causng these errors, so can only guess... Try to google for these errors ... so you would find something like [c++ - function is not a member of global namespace - Stack Overflow](https://stackoverflow.com/questions/21842142/function-is-not-a-member-of-global-namespace)
-
This may occur when the source file is compiled as C. If it is a plain C file (.c) you should not include cstdio but stdio.h. If it is a C++ file (or should be compiled as such), set the appropriate option in the project settings (I have no VS21012 here but it should be at "C/C++ - Advanced" - "Compile As") to compile all files as C++, or rename source files to .cpp.
Dear I have done it several times, but same errors are getting produced. Problem is not with code...problem is if vc++ 2012 compiler IDE... Am I missing some library/ switch..? -Pankaj
-
Unfortunately you haven't shown the code causng these errors, so can only guess... Try to google for these errors ... so you would find something like [c++ - function is not a member of global namespace - Stack Overflow](https://stackoverflow.com/questions/21842142/function-is-not-a-member-of-global-namespace)
Dear programmer, Code does not have any issue...VS 2012 IDE setting has... Even I posted same problem in several boards..a programmer suggested that I should make a simple program on Visual C++ 2012 IDE, with . I made a simple app with only ..(library/header...namespace as documentation says of microsoft). Again same error on compilation... 1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio(39): error C2039: 'fclose' : is not a member of '`global namespace'' 1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio(39): error C2873: 'fclose' : symbol cannot be used in a using-declaration ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========.. Am i missing some setting..? -Pankaj
-
Dear I have done it several times, but same errors are getting produced. Problem is not with code...problem is if vc++ 2012 compiler IDE... Am I missing some library/ switch..? -Pankaj
I can't really help without knowing what you are doing and do not have VS2012 here. But this should compile (console project with pre-compiled headers):
#include "stdafx.h"
// stadfx.h:
// Sets WINVER and _WIN32_WINNT
// #include <windows.h>
// #include <tchar.h>
#includeint _tmain(int argc, _TCHAR* argv[])
{
// May also use ::fopen() and ::fclose() instead
FILE *f = fopen(_T("test"), _T("r"));
fclose(f);
return 0;
} -
Dear programmer, Code does not have any issue...VS 2012 IDE setting has... Even I posted same problem in several boards..a programmer suggested that I should make a simple program on Visual C++ 2012 IDE, with . I made a simple app with only ..(library/header...namespace as documentation says of microsoft). Again same error on compilation... 1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio(39): error C2039: 'fclose' : is not a member of '`global namespace'' 1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio(39): error C2873: 'fclose' : symbol cannot be used in a using-declaration ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========.. Am i missing some setting..? -Pankaj
I used VC++ 2008...there is not as much fussy issue, as VC++ 2012 is producing(useless hurdles)....program itself has complex logic... Issue is closed..I changed environmnt vc++ 2008..