首页 > 解决方案 > C++:类未定义

问题描述

我正在为一些我根本不理解的基本错误而苦苦挣扎。

实用程序.cuh

#pragma once

#include "stdafx.cuh"
#include "NCMForest.cuh"
#include "NCMTree.cuh"

int readCSV(int Nrow, int Ncol, char *sep, char *filename, double **data, char **fields_names);
int closest_centroid(c_Node **pnodes, double *element, int nb_centroids, int nb_features);

NCMForest.cuh

#pragma once

#include "utils.cuh"
#include "stdafx.cuh"
#include "NCMTree.cuh"

class c_Forest
{
    int nb_trees;
    int max_depth;
    int max_features;
    int min_samples_split;

    c_Tree **trees;
};

NCMTree.cuh

#pragma once

#include "utils.cuh"
#include "stdafx.cuh"
#include "NCMForest.cuh"

class c_Node;
class c_Tree;

class c_Node
{
public:
    float *centroid;        //Centroid coords
    bool is_leaf;           //Is it a leaf
    int nb_children;        //How many children
    c_Node **children;      //Node children

    c_Node();
    int update_centroid();  //Update the centroids

    double **current_data;
};


class c_Tree
{
public:
    int ID;                 //Tree ID
    c_Node *root;           //Root node

    c_Tree(int p_features_per_node, int p_max_depth, int p_min_samples_split, int p_min_sample_leaf, int p_nb_features);
    ~c_Tree();
    int train(int nb_labels, c_Node *currentNode);
    int classify(double *element, c_Node *Node);
};

第一个是NCMForest.cuh第 14 行的标识符“ c_Tree ”未定义。第二个是utils.cuh第 8 行的标识符“c_Node”未定义

我不明白为什么我有这个错误。定义此类的标头包含在文件中。有什么线索吗?:/

标签: c++classvisual-c++cudainclude

解决方案


推荐阅读