Compile line (MinGW_w64) g++ main.cpp func1.cpp func2.cpp -o main.exe -std=c++11
I would have thought that it would not matter that the func1.cpp and func2.cpp files have functions with the same name in each file (as they have no "visibility" of each other), but the linker does not agree. What am I missing here?
Either declare and define func() within an anonymous unnamed namespace namespace { void Func() {} }
Or use the storage-class specifier static: static void Func() {}
To confer internal linkage. This effectively limits Func() to the translation unit.
Ahh thank you so much mbozzi - static was what I needed. Somehow I've never come across issues with linkage like this before. Never too old to learn new ways of making mistakes I guess :)