Hi,

I am trying to understand the usage of namespace. I have written the below simple code which compiles with out any issues. But while linking I am getting the error "dummain.obj : error LNK2005: "class dum oss:" (?d@oss@@3Vdum@@A) already defined in dumma.obj" . If I dont use namespae, it gets linked. Could any please tell me what I am doing wrong and how can I fix so that I can use namespae.

Thanks,
Abbas

Code:
//File Name "dummain.cpp"
#include "dumma.h"
using namespace oss; //If I remove this line and add "dum d" code works fine.

int main(void)
{
    d << "Testing";
    return 0;
}
Code:
//File Name "dumma.h"
#include <stdio.h>

class dum{
    public:
    void operator << (char *);
};

namespace oss{
    dum d;
}
Code:
//File Name "dumma.cpp"
#include "dumma.h"

void dum::operator <<(char *inp)
{
   printf("%s\n",inp);
}