visual-studio-2010 - Visual Studio 给我编译错误 : Too Few Arguments to call

标签 visual-studio-2010 compilation compiler-errors

出于某种原因,我收到错误:'dlist_init':调用的参数太少。这是我的主要内容。我看不出我的 dlist_init 有什么问题,或者我在 main.dlist_init 中使用它会初始化双向链表。函数在main之后的数据文件中。

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
//#include "bool.h"
#include "Dlinklist.h"
#include "DlistElmt.h"
#include "Dlist.h"
#include "Dlistdata.h"

   /**************************************************************************************************/

int main ( int argc, char *argv[] )
{
    FILE *ifp, *ofp;
    //char outputFilename[] = argv[2];
    int *hour, *min;
    Dlist *list;
    float *temp;
    char line[15];

    if ( argc != 3 ) /* argc should be 3 for correct execution */
    {
        /* We print argv[0] assuming it is the program name */
        printf( "usage: %s filename", argv[0] );
    }
    else 
    {
        // We assume argv[1] is a filename to open
        ifp = fopen( argv[2], "r" );

        if (ifp == 0 ){

            printf("Could not open file\n");
        }

        else{

            ofp = fopen(argv[2], "w");

            dlist_init(list);

            while (fscanf(ifp, "%d:%d %f ", &hour, &min, &temp) != EOF) {
            //while( fgets(line, 100, ifp)){
                puts(line);
                fprintf(ofp, "%s", line);
                //if(sscanf("%d:%d %df", &hour, &min, &temp)==3){

                //}
            }

/**************************************************************************************************/

            /*while (fscanf(ifp, "%d:%d %df ", &hour, &min, &temp) != EOF) {
                 printf("the tempeture is  %df at %d:%d\n", temp, hour, min);
                fprintf(ofp, "the tempeture is  %df at %d:%d\n", temp, hour, min);*/
/**************************************************************************************************/

            }

fclose(ifp);
fclose(ofp);


        }

    getchar();
}

这是我的函数文件:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
//#include "bool.h"
#include "Dlinklist.h"
#include "DlistElmt.h"
#include "Dlist.h"
#include "Dlistdata.h"

/**************************************************************************************************/

 void dlist_init(Dlist *list){

    list->size = 0;
    list->head = NULL;
    list->tail = NULL;



}

void dlist_destroy(Dlist *list){

    int *time;
    int *time2;
    float *temp;

    while (list->size > 0){
        dlist_remove(list, list->head);
    }


}

int dlist_ins_next(Dlist *list, DlistElmt *element, int *time, int *time2, float *temp1){

        DlistElmt *new_element;


        if (element == NULL && dlist_size(list) != 0)
            return -1;
        if ((new_element = (DlistElmt *)malloc(sizeof(DlistElmt))) == NULL)
            return -1;
        new_element->hour = time;
        new_element->min = time2;
        new_element->temp = temp1;
            if (dlist_size(list) == 0) {

            list->head = new_element;
            list->head->prev = NULL;
            list->head->next = NULL;
            list->tail = new_element;

        }

        else {

            new_element->next = element->next;
            new_element->prev = element;

            if(element->next == list->tail)
                list->tail = new_element;
            else
                element->next->prev = new_element;
        }

        element->next = new_element;
        list->size++;

        return 0;

    }

  int dlist_ins_prev(Dlist *list, DlistElmt *element, int *time, int *time2, float *temp1){

    DlistElmt *new_element;

    if (element == NULL && dlist_size(list) != 0)
        return -1;

    if ((new_element = (DlistElmt *)malloc(sizeof(DlistElmt))) == NULL)
        return -1;

    new_element->hour = time;
        new_element->min = time2;
        new_element->temp = temp1;

    if (dlist_size(list) == 0){

        list->head = new_element;
        list->head->prev = NULL;
        list->head->next=NULL;
        list->tail = new_element;

    }

    else{

        new_element->next = element;
        new_element->prev = element->prev;

        if(element == list->head)
            list->head = new_element;
        else
            element->prev->next = new_element;

        element->prev = new_element;

    }

    list->size++;

    return 0;
    }
 int dlist_remove(Dlist *list, DlistElmt *element){

    if (element == NULL || dlist_size(list) == 0)
        return -1;


    if (element == list->head) {

        list->head = element->next;

        if (list->head == NULL)
            list->tail = NULL;
        else
            element->next->prev = NULL;
    }

    else{

        element->prev->next = element->next;

        if (element == list->tail)
            list->tail = element->prev;
        else
            element->next->prev = element->prev;
    }

    free(element);

    list->size--;

    return 0;

  }

最佳答案

假定函数原型(prototype)是在您的头文件之一中声明的 - 它是否与您提供的声明相匹配?

关于visual-studio-2010 - Visual Studio 给我编译错误 : Too Few Arguments to call,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12787172/

相关文章:

c# - 如何为 OpenFileDialog 框中的取消按钮编写代码

python - 使用 pyinstaller 文本无法解码

c - 编译后偶尔会死机

c - 我在编译和运行我的 C 程序时遇到问题。命令是什么?

c# - Visual C# Directory.GetDirectories 问题 - "The specified server cannot perform the requested operation"

c# - Visual Studio C++ 和 C# 的键盘快捷键

c++ - 视觉检漏仪不起作用

python - 我收到此错误 --> TypeError : string indices must be integers

compiler-errors - 三.WebGL程序错误X6077

c++ - 为什么这是模棱两可的?我能做些什么来解决这个问题?