head.h
#pragma once namespace foo { int bar; int funct1(); }
head.cpp
#include \"head.h\" int foo::funct1() {
This foo namespace-level bar declaration:
foo
bar
namespace foo { int bar; }
is actually a definition.
To make it a declaration, mark the bar as extern in head.h:
extern
namespace foo { extern int bar; }
Then define it in head.cpp:
int foo::bar = 0;