Show differencesHistory of post edits
#Actualbradbobak
Posted 26 January 2012 - 01:53 AM
header guards (or pragma once) just make sure that the header file is read one time per tu (translation unit). so if a.cpp includes it, and b.cpp includes it, and you compile a.cpp and b.cpp separately, there will be 2 instances of 'LogicContainer logic'. Simplest solution is to put 'extern LogicContainer logic' in the header file, and define 'LogicContainer logic' in some .cpp that will be linked in.
#1bradbobak
Posted 26 January 2012 - 01:44 AM
header guards (or pragma once) just make sure that the header file is read one time per tu. so if a.cpp includes it, and b.cpp includes it, and you compile a.cpp and b.cpp separately, there will be 2 instances of 'LogicContainer logic'. Simplest solution is to put 'extern LogicContainer logic' in the header file, and define 'LogicContainer logic' in some .cpp that will be linked in.