good day.. i am starting to learn..and experiment in namespaces
just simple one... calling void functions..then print
f.h
#include<iostream>
#include<limits>
namespace A
{
void f()
{
std::cout<< "Testing \"void f()\"";
std::cout<<std::endl;
}
}
f.cpp
#include "f.h"
int main ()
{
A::f();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
std::cin.get();
}
g.h
#include<iostream>
#include<limits>
namespace A
{
void g()
{
std::cout<< "Testing \"void g()\"";
}
}
g.cpp
#include "g.h"
int main ()
{
A::g();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
std::cin.get();
}
errors
Error 3 fatal error LNK1169: one or more multiply defined symbols found
Error 2 error LNK2005: _main already defined in f.obj g.obj
Error 1 error LNK2005: "void __cdecl A::g(void)" (?g@A@@YAXXZ) already defined in f.obj
i already tried two headers then calling it in 1 cpp.. and it works...
but i want it in two cpp..
help me..thanks