c++ - C++11 cannot resolve nested namespace -


say create class foo in foo.h under namespace fooo follows:

foo.h:  namespace fooo {     class foo {     }; } 

and corresponding source file:

foo.cpp:  namespace fooo { foo::foo() { } }  

i write source file util.cpp create utility functions foo class in util.cpp:

util.cpp:  namespace fooo {     namespace util {         void helper() {         }     } } 

now in main.cpp when call fooo::util::help(), compiler gives me following error:

error: no member named 'util' in namespace 'fooo'

any thoughts on this? it's strange me.

note: using clang++ 3.6 -std=c++11 supports.

you want declare helper in .h file , include file in main.cpp.

the problem compilation unit main.cpp hasn't been given declaration of function. far compiler concerned, no such function exists.

minimally, compiler needs know arguments takes can generate code call it.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -