######################################## # nested.h ######################################## #pragma once static inline void function() { class Nested { Nested(){ } ~Nested() {} }; } ######################################## # first_source.cpp ######################################## #include "nested.h" void first_caller() { function(); } ######################################## # second_source.cpp ######################################## #include "nested.h" void second_caller() { function(); } ######################################## # output ######################################## 1>------ Build started: Project: NestedTest, Configuration: Debug Win32 ------ 1>Compiling... 1>first_source.cpp 1>second_source.cpp 1>Generating Code... 1>Linking... 1>second_source.obj : error LNK2005: "private: __thiscall `void __cdecl function(void)'::`2'::Nested::Nested(void)" (??0Nested@?1??function@@YAXXZ@AAE@XZ) already defined in first_source.obj 1>second_source.obj : error LNK2005: "private: __thiscall `void __cdecl function(void)'::`2'::Nested::~Nested(void)" (??1Nested@?1??function@@YAXXZ@AAE@XZ) already defined in first_source.obj 1>C:\Users\Administrator\Desktop\NestedTest\Debug\NestedTest.dll : fatal error LNK1169: one or more multiply defined symbols found 1>Build log was saved at "file://c:\Users\Administrator\Desktop\NestedTest\NestedTest\Debug\BuildLog.htm" 1>NestedTest - 3 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========