dantc12
dantc12

Reputation: 88

C2055 error - expected formal parameter list, not a type list

I keep getting this error:

C2055 error - expected formal parameter list, not a type list

I know what it means; I read about it on the Internet, yet I don't understand why I keep getting it. The part of my code that triggers the error (the file is called other_funcs.c):

#include "main_funcs.h"
#include "other_funcs.h"

void addWord(sWord **first) //line #4
{
    sWord *after;
    char *input_string, *part;
    const char seperator[4] = "_#_";

    /.......bla bla.... more code.../

sWord is a struct. The error is:

1>d:\cs - exercises\ex5\backup\new folder\other_funcs.c(4): error C2055: expected formal parameter list, not a type list

I don't know if this is necessary, but the header file with the the addWord() function is called other_funcs.h:

#ifndef OTHER_FUNCS_H
#define OTHER_FUNCS_H

void addWord(sWord**);
char *inputString();
int badInput(char*);
void removeWord(sWord**);
int checkYear(sWord*, unsigned short);
int my_strlen(char*);
int countDist(char*, char*);
int new_alreadyThere(sWord*, char*)
#endif

Upvotes: 3

Views: 4525

Answers (2)

SLaks
SLaks

Reputation: 887797

You're missing a semicolon on the last line of the header file.

This confuses the compiler when it tries to parse the next line.

Upvotes: 3

Roddy
Roddy

Reputation: 68054

When you get a truly weird compiler error, look at the preceding line.

In this case (ignoring whitespace and preprocessor directives), it's this, from the header file.

int new_alreadyThere(sWord*, char*)

You're missing a semicolon at the end of it.

Upvotes: 11

Related Questions