zoukankan      html  css  js  c++  java
  • 测试

    有一天,你运用了extern、volatile,结构显示conflicting type qualifiers


    myhead.h

          1 #ifndef MYHEAD                                                                                              
          2 #define MYHEAD
          3
          4 extern int a;
          5 extern void show();
          6
          7 #endif

    test.c

          1 #include <stdio.h>                                                                                          
          2 #include "myhead.h"
          3 int a=3;
          4 int main(int argc, char *argv[])
          5 {
          6
          7     show();
          8     printf("%d\n",3);
          9     return 0;
         10 }

    或者:

    myhead.h

          1 #ifndef MYHEAD                                                                                              
          2 #define MYHEAD
          3
          4 externvolatile  int a;
          5 extern void show();
          6
          7 #endif

    test.c

         1 #include <stdio.h>                                                                                          
          2 #include "myhead.h"
          3 volatile int a=3;
          4 int main(int argc, char *argv[])
          5 {
          6
          7     show();
          8     printf("%d\n",3);
          9     return 0;
         10 }


    volatile 必须在两个文件中同时写明。

  • 相关阅读:
    OpenFileDialog 类的ShowDialog() 错误的解决
    DataTable.Select()使用心得
    postgis 自相交数据检测 修复
    postgresql 添加列主键自增
    postgresql 死锁处理
    linux 安装中文字体(生成图片中文乱码解决)
    Dockerfile 部署jar
    SpringBoot学习总结文章
    怎样在Linux服务器上部署自己的项目?(超详细)
    关于连接Redis时Could not get a resource from the pool问题
  • 原文地址:https://www.cnblogs.com/openix/p/2735724.html
Copyright © 2011-2022 走看看