Hi All
Is the following approach correct? Well i get a compilation error.
a.hpp is
#include <iostream>
class a
{
public:
void classa_f();
};
a.cpp is
#include "a.hpp"
void a::classa_f()
{
std::cout<< "a::classa_f\n";
}
main.cpp
#include <iostream>
namespace myname {
#include "a.hpp"
}
int main ()
{
myname::a obj;
obj.classa_f();
return 0;
}
I get the following error
g++ main.cpp a.o
/tmp/ccOOf5s7.o: In function main':
main.cpp:(.text+0x11): undefined reference to
myname::a::classa_f()'
collect2: ld returned 1 exit status
Well my question is, is it possible to have just the includes under the namespace but not the actual implementation, because I can see that compiler is searching the namespace for he definition of the function.which is actually not there.