c++ - C++ 需要一个类型说明符
问题描述
我尝试使用构造函数将类对象创建到另一个类中,但出现“需要类型说明符”的错误。我研究了示例代码,但在我的代码中找不到任何错误。错误在Cotp_connection.h
文件中LinkedList<uint8_t> list(0,NULL);
链表.h
#include <cstdint>
#include <vector>
using namespace std;
template <class T> class LinkedList
{
public:
LinkedList() {};
LinkedList(int size, LinkedList* next) :size(size), next(next) {};
vector <T> data;
int size;
LinkedList* next;
};
Cotp_connection.h
#include "connect_tcp.h"
#include "LinkedList.h"
class Cotp_connection {
public:
LinkedList <uint8_t> list(0,NULL); // Error is here
};
解决方案
推荐阅读
- image-processing - 你如何在 kaggle 中使用 GPU 和 TPU?
- python - Anaconda 版本更新不起作用(Windows)
- node.js - 如何让 Puppeteer 或 Playwright 在 Azure Web App Service (Linux) 上工作
- java - io.grpc.StatusRuntimeException:从谷歌云 PubSub 获取主题(发布者)名称时 DEADLINE_EXCEEDED
- python-3.x - Python:如何使用解析的 XML 字符串中的属性和值填充嵌套字典?
- javascript - 从对象数组中删除特定对象,通过键值对过滤
- python - Pandas - groupby ID 输入一个后选择购买的物品
- go - 如何计算包含数据的单元格
- linux - 将环境变量值导入文件 Shell 脚本
- python - 在 python 字典中查找重复次数最多的值