Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 瑞士星历程序swetest-Windows和Ubuntu中的不同输出_C_Windows_Ubuntu 18.04 - Fatal编程技术网

C 瑞士星历程序swetest-Windows和Ubuntu中的不同输出

C 瑞士星历程序swetest-Windows和Ubuntu中的不同输出,c,windows,ubuntu-18.04,C,Windows,Ubuntu 18.04,我一直在使用瑞士星历软件附带的SWEEST程序来计算各种行星的经度位置。到目前为止,我一直在使用Windows10,我得到的价值与流行的商业软件相当 最近,我尝试将我的应用程序迁移到Ubuntu(特别是Google Colab附带的Ubuntu VM),第一个挑战是,与Windows不同,该站点没有Linux可执行文件。它们提供C代码和一个Makefile来编译相同的代码 我使用了Colab gcc(Ubuntu7.4.0-1ubuntu1~18.04.1)7.4.0上的gcc和Make文件来编

我一直在使用瑞士星历软件附带的SWEEST程序来计算各种行星的经度位置。到目前为止,我一直在使用Windows10,我得到的价值与流行的商业软件相当

最近,我尝试将我的应用程序迁移到Ubuntu(特别是Google Colab附带的Ubuntu VM),第一个挑战是,与Windows不同,该站点没有Linux可执行文件。它们提供C代码和一个Makefile来编译相同的代码

我使用了Colab gcc(Ubuntu7.4.0-1ubuntu1~18.04.1)7.4.0上的gcc和Make文件来编译该文件。出现了一些警告,但程序按预期编译和执行

问题是Windows版本中生成的经度值与Ubuntu版本中生成的经度值不同。差别不大,但仍然显著。特别是对于上升者

实际汇编见

有没有办法解决这个问题?如果有,从哪里开始

make命令的输出如下所示

cc   -c -g -Wall -fPIC         swetest.c     
swetest.c: In function ‘main’:
swetest.c:1377:9: warning: format not a string literal and no format arguments [-Wformat-security]
  printf(stimeout);
         ^~~~~~~~
swetest.c:1712:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (hpos_meth == 1)
    ^~
swetest.c:1714:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      if (ipl == SE_FIXSTAR)
      ^~
swetest.c:1833:12: warning: format not a string literal and no format arguments [-Wformat-security]
     printf(smod);
            ^~~~
swetest.c: In function ‘print_line’:
swetest.c:2017:32: warning: format not a string literal and no format arguments [-Wformat-security]
         if (is_label) { printf(slon); break; }
                                ^~~~
swetest.c:2026:32: warning: format not a string literal and no format arguments [-Wformat-security]
         if (is_label) { printf(slon); break; }
                                ^~~~
swetest.c:2046:32: warning: format not a string literal and no format arguments [-Wformat-security]
         if (is_label) { printf(slon); break; }
                                ^~~~
cc   -c -g -Wall -fPIC         swedate.c     
cc   -c -g -Wall -fPIC         swehouse.c     
cc   -c -g -Wall -fPIC         swejpl.c     
cc   -c -g -Wall -fPIC         swemmoon.c     
cc   -c -g -Wall -fPIC         swemplan.c     
cc   -c -g -Wall -fPIC         swepcalc.c     
cc   -c -g -Wall -fPIC         sweph.c     
cc   -c -g -Wall -fPIC         swepdate.c     
cc   -c -g -Wall -fPIC         swephlib.c     
swephlib.c: In function ‘swe_get_astro_models’:
swephlib.c:4271:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_PREC_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4271:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_PREC_DEFAULT) imod = 0; break;
                                            ^~~~~
swephlib.c:4273:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_PREC_DEFAULT_SHORT) imod = 0; break;
  ^~
swephlib.c:4273:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_PREC_DEFAULT_SHORT) imod = 0; break;
                                                  ^~~~~
swephlib.c:4275:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_NUT_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4275:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_NUT_DEFAULT) imod = 0; break;
                                           ^~~~~
swephlib.c:4277:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_SIDT_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4277:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_SIDT_DEFAULT) imod = 0; break;
                                            ^~~~~
swephlib.c:4279:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_BIAS_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4279:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_BIAS_DEFAULT) imod = 0; break;
                                            ^~~~~
swephlib.c:4281:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_JPLHOR_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4281:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_JPLHOR_DEFAULT) imod = 0; break;
                                              ^~~~~
swephlib.c:4283:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_JPLHORA_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4283:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_JPLHORA_DEFAULT) imod = 0; break;
                                               ^~~~~
swephlib.c:4285:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_DELTAT_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4285:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_DELTAT_DEFAULT) imod = 0; break;
                                              ^~~~~
cc   -c -g -Wall -fPIC         swecl.c     
swecl.c: In function ‘swe_rise_trans_true_hor’:
swecl.c:4444:11: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
           if (!do_fixstar)
           ^~
swecl.c:4447:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      if (rsmi & SE_BIT_GEOCTR_NO_ECL_LAT)
      ^~
cc   -c -g -Wall -fPIC         swehel.c     
swehel.c: In function ‘calc_rise_and_set’:
swehel.c:478:1: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
 else
 ^~~~
swehel.c:484:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
   iflag = epheflag|SEFLG_SPEED|SEFLG_EQUATORIAL;
   ^~~~~
ar r libswe.a   swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swepcalc.o sweph.o swepdate.o swephlib.o swecl.o swehel.o
ar: creating libswe.a
cc   -g -Wall -fPIC        -o swetest swetest.o -L. -lswe -lm -ldl

这个练习背后的动机——在Ubuntu中重新编译程序——是出于从Windows迁移到Unix/Ubuntu平台的需要或愿望,特别是在托管的VM环境(如Google Colab)上。现在,通过完全不同的途径实现了同样的目标

存在一个名为if installed的Python包,它使您能够直接调用必要的相关函数以获得相同的结果

下面是演示如何实现这一点的示例Colab笔记本