编译器在类中抛出我的函数错误,我vecListAtt connFrFile(int file_ext);
不知道为什么。错误说
“错误:声明与“vecListAtt neighborAtt::connFrFile(int file_ext)”不兼容(在连接性.h 中声明)”
连接性.h:
#if !def connectivity_H
#define connectivity_H
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <sstream>
#include <fstream>
class listAtt;
class vecListAtt;
class neighborAtt
{
public:
neighborAtt(); //default constructor
neighborAtt(int neighbor_id, int att_1, int att_2);
vecListAtt connFrFile(int file_ext);
vecListAtt makeList(std::vector<std::list<neighborAtt>> nodeAndInfo, int nodeID, neighborAtt neighAndAtt);
neighborAtt getAtt(std::string currentLine);
private:
int neighborID;
int attribute1;
int attribute2;
};
typedef std::list<neighborAtt> listAtt;
typedef std::vector<listAtt> vecListAtt;
#endif
在connectivity.cpp中,我定义
vecListAtt neighborAtt::connFrFile(int file_ext)
{
vecListAtt node_and_info;
return node_and_info;
}