c++ - Access global namespace from proxy header -


i have namespace called "access" in project. used in many places inside project. writing unit test case project. unit test, io.h file getting included ut frame work. io file contains c function called "access". when tried include both io file , 1 of project file, got re-definition error "access".

so tried use proxy header solving above problem. proxy header included frame work header file in namespace avoid re-definition error.

but frame work file accessing global namespaces. getting more issues that. there way solve issue without renaming namespace.

here sample code.

#pragma once  #include "io.h" #include <iostream>  class class01 { public:     class01(void);     ~class01(void);     void function() {         std::cout<< " write something";} 

};

#pragma once  namespace access {    class class02   {   public:     class02(void);     ~class02(void);   }; } 

proxy header

  #pragma once      namespace sample     {         #include "class01.h"     };     #include "class02.h"   // namespaceredef.cpp : defines entry point console application. // #include "stdafx.h" //#include "class02.h" //#include "class01.h" #include "proxyheader.h"  using namespace sample;  int _tmain(int argc, _tchar* argv[]) {     return 0; } 

when compile code, got following error...

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error c2039: 'acosf' : not member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error c2873: 'acosf' : symbol cannot used in using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error c2039: 'asinf' : not member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error c2873: 'asinf' : symbol cannot used in using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error c2039: 'atanf' : not member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error c2873: 'atanf' : symbol cannot used in using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error c2039: 'atan2f' : not member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error c2873: 'atan2f' : symbol cannot used in using-declaration


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -