首页 > 解决方案 > c未定义引用中的链接器错误

问题描述

我收到以下错误:

undefined reference to 'delete'
ld returned 1 exit status 

我认为这意味着我错误地调用了该函数,但是所有 3 个函数都以相同的方式调用,并且只有 delete 函数给出了错误。我似乎无法弄清楚为什么

#include <stdlib.h>
#include <stdio.h>
#include <string.h>



typedef struct node{
    char pln[30];
    char pfn[20];
    int pid;
    float pwt;
    float phgnum;
    struct node* next;
    struct node* back;
}node;

typedef struct head{
    float avghg;
    float avgwt;
    int pntcnt;         
    struct node *first;
    struct node *rear;
}head;



void questions(head *header);
head* create_node(head *header);
head* delete(head *header);

int main(){


    head *header;
    int option;
    do {
        printf("Press 1 to input  Paitients\n");
        printf("Press 2 to Delete a Paitient\n");
        printf("Press 3 to ask Questions:\n");
        printf("Select Option: ");
        scanf("%i", &option);

        if (option == 1) {
            header = create_node(header);
            continue;
        }
        if (option == 2) {
            header = delete(header);
            continue;
        }
        if(option == 3){
            void questions(header);
        }
    } while (option != 4);

    return 0;
}


 head* create_node(head *header){
}

head* delete(head *header){
}

void questions(head *header){
}

标签: clinker-errorsundefined-reference

解决方案


推荐阅读