C ++ Strange Circular Dependecy错误

时间:2018-03-16 21:39:40

标签: c++ circular-dependency

当我尝试编译我的代码时,它会抛出66个错误,所有错误只是from copy import deepcopy from typing import TypeVar Cls = TypeVar('Cls') # This type hint is a dirty lie to make autocomplete and static # analyzers give more useful results. Crazy the stuff you can do # with python... def copy_class(cls: Cls) -> Cls: copy_cls = type(f'{cls.__name__}Copy', cls.__bases__, dict(cls.__dict__)) for name, attr in cls.__dict__.items(): try: hash(attr) except TypeError: # Assume lack of __hash__ implies mutability. This is NOT # a bullet proof assumption but good in many cases. setattr(copy_cls, name, deepcopy(attr)) return copy_cls def test_copy_class(): class A(object): mutable_class_var = [] ACopy = copy_class(A) a = A() acopy = ACopy() acopy.mutable_class_var.append(1) assert a.mutable_class_var == [] assert A.mutable_class_var == [] assert ACopy.mutable_class_var == [1] assert acopy.mutable_class_var == [1] 个错误(重复行)。我尝试了Include guards,mat4.h

代码
mat4.h

#pragma once

mat4.cpp 文件太大所以我会把它贴在pastebin上。 https://pastebin.com/FYSZV9ZX

1 个答案:

答案 0 :(得分:0)

你的vec3和vec4标题是否包括mat4?
如果是,则没有必要,然后删除包含。