错误:'serve'声明中有两个或更多数据类型

时间:2014-09-25 22:19:37

标签: c++ operating-system extern

我收到此错误。 serve函数只接受创建的url并将它们放在名为downloads的目录中。

../threads/threadtest.cc:18: two or more data types in declaration of `serve'

我声明这样的服务:

extern void serve(char *url);

为什么我会收到这样的错误? 代码:

#include "copyright.h"
#include "system.h"
#include <stdio.h>
#include "request.h"


extern void serve(char *url);

//GLOBAL VARIABLE LIST                                                                     
List *list;

void
ClientThread(int request)
{
  const int sz = 50;
  char url[sz];

  FILE *fp = fopen("url.txt", "r");
  if (!fp)
    printf("  Cannot open file url.txt!\n");
  else {
    int pos = 0;
    char c = getc(fp);
    while (c != EOF || pos == sz - 1) {
      if (c == '\n') {
        url[pos] = '\0';
        serve(url);
        pos = 0;

        //Store necessary information in a Request object for each request.                
        Request req(url, request, 1);

        Request *reqq = &req; //req points to the object                                   
        list->Append(reqq);
      }
      else {
        url[pos++] = c;
      }
      c = getc(fp);
    }
    fclose(fp);
  }
}

0 个答案:

没有答案