Experimenting with modules in msvc compiler and cmake and can't figure out how to prevent importing headers from importing it multiple times for example if you
import <A.h>;
import <B.h>; //B.h includes A.h
I get multiple definition/already defined errors. Is there a way to import both and have the inclusion guards work correctly?
For reference I am trying google test
No errors
import <gmock/gmock-matchers.h>;
However,
import <gmock/gmock-matchers.h>; //this file includes "gtest.h"
import <gtest/gtest.h>;
``` results in
```Error LNK2005: "char const * const testing::internal::kDeathTestStyleFlag" (?kDeathTestStyleFlag@internal@testing@@3QBDB) already defined in gmock-matchers
...
This also works
#include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
``` however it says not to include headers in modules on cppreference so not sure what the best way to go about this is. Any help/guidance is appreciated, thanks.