Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++- error C2144 syntax error : 'int' should be preceded by ';' [closed]

Tags:

c++

I'm trying to compile this C++ code:

#include <stdlib.h>
#include <stdio.h>   
#include <string.h>
#include "general_configuration.h"
#include "helper_functions.h"

#define LINE_LEN 80

// file_with_as_ext returns 1 if the input has .as extension
int file_with_as_ext(char* input)
{
  char* dot_value = strchr(input, '.');
  if (dot_value == NULL)
    return 0;
  else
  {
    if (strcmp(dot_value,".as") == 0)
      return 1;
  }
}

But I'm getting the error "C2144: syntax error : 'int' should be preceded by ';'"

And I can't understand why, because #define doesn't need ';' at the end.

like image 228
judith Avatar asked Aug 04 '12 11:08

judith


1 Answers

I encounted this issue. I wrote a header file, but I forgot to add ";" at the tail of a function declaration. So, there is a error in my c file which is include this header file. I add comment here, and hope it will be useful for someone.

like image 182
Serval Avatar answered Sep 24 '22 23:09

Serval