There are many question about this error. But they are related to only a single variable.
test.h
namespace World
{
enum Objects
{
TERRAIN = 1,
BOX = 2,
SPHERE = 4,
CAPSULE = 8
};
void WorldObjects2(unsigned int mask)
{
.......
}
}
void test();
test.cpp
#include "test.h"
void test()
{
.......
}
main.cpp
#include "test.h"
int main()
{
test();
return 0;
}
When I run these code on visual stduio 2013, it throws an error. It says that error LNK2005: "void __cdecl World::WorldObjects2(unsigned int)" (?WorldObjects2@World@@YAXI@Z) already defined in main.obj
. How can I correct this error?