M
Maximus
How to import a function in another translation unit with a namespace? Let's
say we have two cpp files:
1.cpp
namesapce mu {
int func() { return 0;}
};
and in 2.cpp, I declare
namespace mu {
extern int func();
};
The compiler (VC 2005) complains that it can not find definition of func(),
obvisousely believing that the "extern" refers to a function in global
namespace.
I can get it work by declaring it in a header file shared by both files.
However, I only need this function definition in 2.cpp so that is not what I
really wanted.
say we have two cpp files:
1.cpp
namesapce mu {
int func() { return 0;}
};
and in 2.cpp, I declare
namespace mu {
extern int func();
};
The compiler (VC 2005) complains that it can not find definition of func(),
obvisousely believing that the "extern" refers to a function in global
namespace.
I can get it work by declaring it in a header file shared by both files.
However, I only need this function definition in 2.cpp so that is not what I
really wanted.