Friend classes across different namespaces. Is that possible

前端 未结 2 1124
北恋
北恋 2021-01-01 12:10

I\'m having problems trying to use the friend feature of C++. I have these interfaces:

#pragma once
#include \"Mesh3D.h\"
#include 
namespace t         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 12:31

    I guess you need to remove following code in the second file:

    #include "GeometryManager.h"
    
    class CGeometryManager3D;
    

    The first line causes circular inclusion as the comments in the question suggests;

    The second line declares a totally irrelevant class as it is in the global name space;

提交回复
热议问题