• linux 跨版本问题


    1 //redhattest.c
    2  #include <stdio.h>
    3  int main()
    4 {
    5 int a=0;
    6
    7 printf ("this is compiled in Red Hat, %d\n",a);
    8
    9 return 0;
    10 }
    11
    gcc -o RadHatTest redhattest.c

    编译完之后放到centos上运行可以正常运行

    Red Hat版本信息
    Red Hat Enterprise Linux AS release 3 (Taroon Update 5)
    Kernel \r on an \m

    Linux version 2.4.21-32.EL (bhcompile@tweety.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)) #1 Fri Apr 15 21:17:56 EDT 2005
    2.4.21-32.EL
    gcc版本信息
    gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-52)
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    1 //centostest.c
    2  #include <stdio.h>
    3 int main()
    4 {
    5 int a=0;
    6
    7 printf ("this is compiled in Centos, %d\n",a);
    8
    9 return 0;
    10 }
    11
    gcc -o CentosTest centostest.c
    编译完之后放到red hat上运行得到"浮点数例外"的错误信息
    centos 版本信息

    CentOS release 5.5 (Final)
    Kernel \r on an \m

    Linux version 2.4.21-32.EL (bhcompile@tweety.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)) #1 Fri Apr 15 21:17:56 EDT 2005

    2.6.18-194.8.1.el5
    gcc版本信息

    gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  • 相关阅读:
    JQuery 介绍
    转载:World class Software
    how to get domain user info from AD in C#
    抽象类与接口的实际应用{百分百的重点}
    设计模式学习笔记
    百度前端笔试面试7个试题
    虚函数在C#中的用法
    设计模式学习MVC实践
    VMware 创建私有网络试验室
    设计模式学习单件模式
  • 原文地址:https://www.cnblogs.com/eavn/p/1810369.html
Copyright © 2020-2023  润新知