C++ 优先级队列实现的编译器错误

C++ 优先级队列实现的编译器错误,c++,linked-list,priority-queue,C++,Linked List,Priority Queue,我正在处理一项任务,即创建优先级队列,而不使用#include库。我写了一些函数,遇到了一个我无法解决的问题 // CSCI 2530 // Assignment: 6 // Author: // File: pqueue.cpp // Tab stops: *** // **Say what this program does here. (replace this comment)** #include <cstdio> #include "std

我正在处理一项任务,即创建优先级队列,而不使用#include库。我写了一些函数,遇到了一个我无法解决的问题

// CSCI 2530
// Assignment: 6
// Author:     
// File:       pqueue.cpp
// Tab stops:  ***

// **Say what this program does here.  (replace this comment)**


#include <cstdio>
#include "stdafx.h"
#include "pqueue.h"

using namespace std;



//Structure PQCell holds an item (item), priority (priority) and
//a pointer to the next item in the priority queue.

struct PQCell 
{
    ItemType item;
    PriorityType priority;
    PQCell* node;

    PQCell() : item(0), priority(0), node()
    {
    }
};

//Checks the the first element of the linked list (q) for
//a NULL value. If the list is empty this first element will be NULL.

bool isEmpty(const PriorityQueue& q)
{
    if (q.next == NULL)
    {
        return false;
    }
    return true;
}
//-------------------------------------------------------------------


void insertCell(PQCell*& L, ItemType x, PriorityType p)
{
    PQCell cell;
    cell.item = x;
    cell.priority = p;
}



void insert(PriorityQueue& q, ItemType x, PriorityType p)
{
    insertCell(q, x, p);
}


int main()
{



    return 0;
}
//CSCI 2530
//作业:6
//作者:
//文件:pqueue.cpp
//制表位:***
//**在此说明此程序的功能。(替换此评论)**
#包括
#包括“stdafx.h”
#包括“PQUE.h”
使用名称空间std;
//结构PQCell包含一个项目(item)、优先级(priority)和
//指向优先级队列中下一项的指针。
结构单元
{
项目类型项目;
优先类型优先;
PQCell*节点;
PQCell():项(0)、优先级(0)、节点()
{
}
};
//检查链表(q)第一个元素的
//空值。如果列表为空,则第一个元素将为空。
bool isEmpty(const PriorityQueue&q)
{
如果(q.next==NULL)
{
返回false;
}
返回true;
}
//-------------------------------------------------------------------
无效插入单元格(PQCell*&L,项目类型x,优先级类型p)
{
pq细胞;
cell.item=x;
cell.priority=p;
}
无效插入(PriorityQueue&q、ItemType x、PriorityType p)
{
插入细胞(q,x,p);
}
int main()
{
返回0;
}
在上面的代码中,它显示了程序的主文件,我在其中编写了一个“insert”和一个“insertCell”函数

insertCell函数应该在调用时将新单元格插入PriorityQueue。但是,当我尝试调用insert cell时,它会给出错误(如上图所示)

另外,这里是我为这个项目创建的头文件

// CSCI 2530
// Assignment: ***
// Author:     ***
// File:       ***
// Tab stops:  ***

// **Say what this program does here.  (replace this comment)**


#include <cstdio>
using namespace std;

struct PQCell;
//Type definitions

typedef const char* ItemType;
typedef double      PriorityType;

struct PriorityQueue
{

    PriorityQueue* next;

    PriorityQueue()
    {
        next = NULL;
    }
};
//Prototypes

bool isEmpty(const PriorityQueue& q);
void insert(PriorityQueue& q, ItemType x, PriorityType p);
//CSCI 2530
//任务:***
//作者:***
//文件:***
//制表位:***
//**在此说明此程序的功能。(替换此评论)**
#包括
使用名称空间std;
结构细胞;
//类型定义
typedef const char*ItemType;
typedef双优先级类型;
结构优先队列
{
优先队列*下一步;
优先级队列()
{
next=NULL;
}
};
//原型
bool-isEmpty(const-PriorityQueue&q);
无效插入(优先级队列和q、项目类型x、优先级类型p);
此外,这里是作业说明的链接。。。。。

您试图将PriorityQueue引用作为第一个参数传递给insertCell,此函数需要一个PQCell作为参数


我认为你的insertCell应该请求PriorityQueue,这样你就可以插入它了

Post-actual code not到screenshotsPriorityQueue和PQCell的链接是完全不相关的类型,但是你试图将PriorityQueue传递给一个指向PQCell的指针的函数。你认为这会怎样?我试图复制你的屏幕快照并粘贴到我的IDE中,但我的IDE不理解屏幕快照。没有代码作为文本==没有帮助。