Scilab Xcos块中的C语言用法

问题描述

我一直在尝试启动并运行我自己的用C语言编写的Scilab Xcos块。我一直在使用在装有Cygwin的Windows 10上运行的Scilab 5.5.2。我从Phil Schmidt编写的名为 ScicosCBlockTutorial 的免费教程开始。我遵循了教程,并在4.2点发现了该函数调用

$(document).ready(function (){
// Set the next delivery date
   var NextDelivery = null;

   $('#date').change(function (){
   // // CalcTimeOut();
   // //    today();
   //    difference();
      Updated();
});
function Updated(){
      var current=new Date();
      var selected=document.getElementById('date').value;
      var selectedDate=new Date(selected);
      var uDate;
      if (selectedDate.getDate()==current.getDate() && selectedDate.getMonth()==current.getMonth()){

          if (current.getHours()<12){

              uDate=current.getDate();
         }
         else{
            uDate=current.getDate()+1;
         }
      }
      else{
         uDate=selectedDate.getDate();
      }
      var uMonth;
      if (selectedDate.getMonth()+1<10){
         var next=selectedDate.getMonth()+1;
         uMonth='0'+next;
      }
      else {

            uMonth = selectedDate.getMonth() + 1;
      }
      if (uDate<10){
         uDate='0'+uDate;
      }
      var orderDate = selectedDate.getFullYear()+'-'+uMonth+'-'+uDate;
      console.log(orderDate);
      document.getElementById('date').value=orderDate;
}

});

不适用于我。一段时间后,我找到了可行的解决方

ilib_for_link('lim_int','lim_int_comp.o',[],'c','Makelib','loader.sce','','-g'); 

不幸的是,C语言编译器似乎存在一些问题:

ilib_for_link('lim_int','lim_int_comp.c','-g');

尽管在我的计算机上安装了gcc编译器(gcc(GCC)9.3.0),还是出现了问题。有人知道如何解决该问题吗?预先感谢。

解决方法

如何启动和运行用于Scilab的C编译器的正确过程是:

  1. download gcc-4.6.3-64.exe
  2. 运行gcc-4.6.3-64.exe
  3. 重启电脑
  4. 打开Scilab并调用atomsInstall('mingw')
  5. 重新启动Scilab

如果已成功完成所有操作,则从Scilab调用函数haveacompiler()应该返回T