对一个文件中的Class::Class()和函数的未定义引用?C++

对一个文件中的Class::Class()和函数的未定义引用?C++,c++,dependencies,circular-dependency,C++,Dependencies,Circular Dependency,一切都进行得很好,我已经浏览了10个不同的问题试图解决它,包括,和。请不要杀我,我已经把头撞在墙上三个小时了。我也尝试过自己构建有问题的文件,它似乎构建得很好,但是当我构建项目时,它仍然抛出相同的错误 我已经尝试过在可能的情况下将include.h移到cpp文件中,这在大多数情况下都没有帮助。当我改变 BitBoards *newBoard = new BitBoards; 到 那一行的错误消失了,但它仍然给了我对newBoard->函数的未定义引用 还有什么显而易见的,或者没有的,我应该试试

一切都进行得很好,我已经浏览了10个不同的问题试图解决它,包括,和。请不要杀我,我已经把头撞在墙上三个小时了。我也尝试过自己构建有问题的文件,它似乎构建得很好,但是当我构建项目时,它仍然抛出相同的错误

我已经尝试过在可能的情况下将include.h移到cpp文件中,这在大多数情况下都没有帮助。当我改变

BitBoards *newBoard = new BitBoards;

那一行的错误消失了,但它仍然给了我对newBoard->函数的未定义引用

还有什么显而易见的,或者没有的,我应该试试吗

错误会在我的逻辑文件中弹出:Ai_logic.cpp

 //master bitboard for turn
BitBoards *newBoard = new BitBoards;
^^here
//master zobrist object for ai turn
ZobristH *mZobrist = new ZobristH;

//master evaluation object - evaluates board position and gives an int value (- for black)
evaluateBB *mEval = new evaluateBB;

newBoard->constructBoards();
^^and here as well as every instance of newBoard-> below
#include "ai_logic.h"

#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include <iostream>

#include "externs.h"
#include "move.h"
#include "evaluatebb.h"
#include "bitboards.h"
#include "movegen.h"
#include "zobristh.h"
Ai_Logic.h:

#include <string>
#include <stack>
#include <thread>
class Pieces;
class ZobristH;
class BitBoards;
class MoveGen;
class evaluateBB;
class HashEntry;

class Ai_Logic
{
//stuff
};
BitBoards.cpp

#include "bitboards.h"
#include <cmath>
#include <random>
#include <iostream>
#include <string>
#include <cstdio>

#include "externs.h"
#include "movegen.h"    

在Ai_中,逻辑文件似乎起到了作用。完全不知道为什么

头文件中的类声明似乎没有右括号或任何实际声明。这是一个格式问题还是你的.h文件真的是这样的?不,对不起,我想这是非常不清楚的。它们有很多我没有包含的变量和函数。它们有右大括号。这种行为还取决于比特板是否是POD,是否有默认构造函数。它们都有默认类:class{};构造器。什么是POD?这里没有足够的信息。请提供一个最小的示例:。您是否声明了任何虚拟函数而没有实现它们?您似乎不理解“声明”或“转发声明”。这是您应该查找的术语。
class MoveGen;
class ZobristH;
class Move;

class BitBoards
{
//stuff
};
#include "bitboards.h"
#include <cmath>
#include <random>
#include <iostream>
#include <string>
#include <cstdio>

#include "externs.h"
#include "movegen.h"    
#include <iostream>
#include <string>
#include "move.h"

class Pieces;
class BitBoards;
class ZobristH;


class MoveGen
{
//stuff
};
#include "movegen.h"
#include "bitboards.h"
#include "Pieces.h"   
#include bitboards.cpp