0

I have header with namespace, where defined methods and include this header in others. g++ gives duplicated symbols error. as for defying vars in namespace everything is ok

header1.h:

namespace A {
    void print() {}
}

code1.h:

#include "header1.h"  

code2.h:

#include "header1.h" 

compiling:

g++ -g --std=c++14 -c code1.cpp

g++ -g --std=c++14 -c code2.cpp

0 Answers0