C++-错误C2144语法错误: 'int' should be preceded by ';'

标签 c++

<分区>

我正在尝试编译此 C++ 代码:

#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;
  }
}

但我收到错误 "C2144: syntax error : 'int' should be preceded by ';'"

我不明白为什么,因为 #define 最后不需要 ';'

最佳答案

我遇到了这个问题。我写了一个头文件,但是我忘了加“;”在函数声明的尾部。因此,我的 c 文件中包含此头文件的错误。 我在这里添加评论,希望它对某人有用。

关于C++-错误C2144语法错误: 'int' should be preceded by ';' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11808432/

相关文章:

c++ - C++11 中的 float 比较

C++ 对 vector vector 中的多列进行排序

C++接口(interface)多重继承的处理方式

c++ - 我在实现++ 增量运算符时遇到问题

c++ - Qt 服务器客户端代码

c++ - 如何让 QWebView 直接渲染到 GStreamer 缓冲区?

c++ - Windows c++ 上 getopt 函数的替代方法是什么?

c++ - C++ 中非常量列表迭代器的奇怪行为

c++ - 保护类不在 main() 之前实例化

c++ - 如何使用 ASCII 3 字母代码转义字符?