c - 头文件出现意外的文件结束符

标签 c visual-studio-2015

我在 VS2015 中遇到问题:

我有一个头文件:

#ifndef DATATYPES_H
#define DATATYPES_H
    const char *OPCODES[16];
    typedef struct symbol{
        struct symbol *next;
        char label[20];
        int address;
        int external;
        int operation;
    }symbolTable;

    typedef struct ops{
        unsigned int ARE: 2;
        unsigned int destAddrs: 2;
        unsigned int orgnAddrs: 2;
        unsigned int opcode: 4;
        unsigned int group: 2;
        unsigned int rnd: 2;
        unsigned int non: 1;
    }opword;
    extern int dc;
    extern int ic;

    extern symbolTable *head;
    extern symbolTable *tail;
#endif

当我构建解决方案时(它是一个基本的命令行应用程序),我在上面的文件(“datatypes.h”)中遇到了这个奇怪的问题“发现意外的文件结尾”。我似乎无法理解为什么会发生这种情况。 仅供引用,我将 VS2105 设置为尽可能接近 ANSI C,即无扩展、编译为 C 等。

谢谢, 埃拉德

最佳答案

嗯,我认为问题出在 C 文件后面的某些地方,可能与编码或其他东西有关,因为我的文件是从另一个文本编辑器带入 VS 的。

我重写了#includeguards并且它工作得很好。幸运的是,这些 header 都很短,重写一个长 header 会很痛苦,而且会浪费大量时间。

关于c - 头文件出现意外的文件结束符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36103182/

相关文章:

c - 在 C 中通过引用传递二维数组

c - realloc 正在覆盖数据

c - Linux 上的 AzSmb 源代码编译错误?

c - 为什么我的 C 代码打印 Segmentation fault : 11?

c# - 无法从用法中推断出开放泛型类型参数

ios - Visual Studio Apache Cordova - iOS 构建运行时缺少 Javascript 文件

C - "Error: Invalid operands to binary != ..."

visual-studio-2015 - Windows 通用应用程序 - Windows 10 没有 "Any CPU"配置?

c++ - 在 Visual Studio 中查找哪个文件包含 iostream

c++ - 关于函数不在全局命名空间中的 Visual Studio 警告