Is there a way to call a function from an unnamed namespace in this situation?
No, not in your case.
Anonymous / UnNamed namespaces allow you to see variables and functions inside the entire translation unit, but are not visible from the outside. Although objects in an unnamed namespace can have an external connection, they are effectively qualified by a name unique to their translation unit, and therefore can never be seen from any other translation unit.
This means that your funkcja function inside the Nameless Namespace is visible in the translation module that defines the global funkcja function. This results in two identical named functions defined in the global scope, resulting in an override error.
If funkcja was only present in your UnNamed namespace, then you could name it ::funkcja , as it would be in your global scope. In conclusion, you can call functions in the UnName namespace depending on the scope in which the UnNamed namespace is present.
source share