compiler錯誤訊息與解決方式(MATLAB)

2023-12-06 00:18

本文主要是介绍compiler錯誤訊息與解決方式(MATLAB),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

compiler錯誤訊息與解決方式

以下為MathWorks所提出的compiler錯誤訊息與解決方式
整理出來請大家參考一下
  
[color=red]Error: An error occurred while shelling out to mex/mbuild (error code = errorno). Unable to build executable (specify the -v option for more information).[/color]   The Compiler reports this error if mbuild or mex generates an error.
  
[color=red]Error: An error occurred writing to file "filename": reason. [/color]   The file could not be written. The reason is provided by the operating system. For example, you may not have sufficient disk space available to write the file.
  
[color=red]Error: Cannot recompile M-file "filename" because it is already in library "libraryname".[/color]   A procedure already exists in a library that has the same name as the M-file that is being compiled. For example:
  
mcc -x sin.m % Incorrect
  
[color=red]Error: Cannot write file "filename" because MCC has already created a file with that name, or a file with that name was specified as a command line argument. [/color]   The Compiler has been instructed to generate two files with the same name. For example:
  
mcc -W lib:liba liba -t % Incorrect
  
[color=red]Error: Could not check out a Compiler license. [/color]   No additional Compiler licenses are available for your workgroup.
  
[color=red]Error: Could not find license file "filename".[/color]   (Windows only) The license.dat file could not be found in <MATLAB>/bin.
  
[color=red]Error: Could not run mbuild. The MATLAB C/C++ Math Library must be installed in order to build stand-alone applications.[/color]   Install the MATLAB C/C++ Math Library.
  
[color=red]Error: File: "filename" not found.[/color]   A specified file could not be found on the path. Verify that the file exists and that the path includes the file's location. You can use the -I option to add a directory to the search path
  
[color=red]Error: File: "filename" is a script M-file which cannot be compiled with the current Compiler. [/color]   The MATLAB Compiler cannot compile script M-files. To learn how to convert script M-files to function M-files, see Converting Script M-Files to Function M-Files.
  
[color=red]Error: File: filename Line: # Column: # != is not a MATLAB operator. Use ~= instead. [/color]   Use the MATLAB relational operator ~= (not equal).
  
[color=red]Error: File: filename Line: # Column: # () indexing must appear last in an index expression. [/color]   If you use ordinary array indexing () to index into an expression, it must be last in the index expression. For example, you can use X(1).value and X{2}(1), but you cannot use X.value(1) or X(1){2}.
  
[color=red]Error: File: filename Line: # Column: # A CONTINUE may only be used within a FOR or WHILE loop.[/color]   Use Continue to pass control to the next iteration of a for or while loop.
  
[color=red]Error: File: filename Line: # Column: # A function declaration cannot appear within a script M-file. [/color]   There is a function declaration in the file to be compiled, but it is not at the beginning of the file. Scripts cannot have any function declarations; function M-files must start with a function.
  
[color=red]Error: File: filename Line: # Column: # Assignment statements cannot produce a result.[/color]   An assignment statement cannot be used in a place where an expression, but not a statement, is expected. In particular, this message often identifies errors where an assignment was used, but an equality test was intended. For example:
  
if x == y, z = w; end % Correct  
if x = y, z = w; end % Incorrect
  
[color=red]Error: File: filename Line: # Column: # A variable cannot be made storageclass1 after being used as a storageclass2.[/color]   You cannot change a variable's storage class (global/local/persistent). Even though MATLAB allows this type of change in scope, the Compiler does not.
  
[color=red]Error: File: filename Line: # Column: # An array for multiple LHS assignment must be a vector.[/color]   If the left-hand side of a statement is a multiple assignment, the list of left-hand side variables must be a vector. For example:  
  
[p1, p2, p3] = myfunc(a)% Correct
[p1; p2; p3] = myfunc(a)% Incorrect
  
[color=red]Error: File: filename Line: # Column: # An array for multiple LHS assignment cannot be empty.[/color]   If the left-hand side of a statement is a multiple assignment, the list of left-hand side variables cannot be empty. For example:  
  
[p1, p2, p3] = myfunc(a)% Correct
[ ] = myfunc(a)% Incorrect
  
[color=red]Error: File: filename Line: # Column: # An array for multiple LHS assignment cannot contain token.[/color]   If the left-hand side of a statement is a multiple assignment, the vector cannot contain this token. For example, you cannot assign to constants.  
  
[p1] = myfunc(a)% Correct
[3] = myfunc(a)% Incorrect
  
[color=red]Error: File: filename Line: # Column: # Expected a variable, function, or constant, found "string".[/color]   There is a syntax error in the specified line. See the online MATLAB Function Reference pages.
  
[color=red]Error: File: filename Line: # Column: # Expected one of , ; % or EOL, got "string".[/color]   There is a syntax error in the specified line. See the online MATLAB Function Reference pages.
  
[color=red]Error: File: filename Line: # Column: # Functions cannot be indexed using {} or . indexing.[/color]   You cannot use the cell array constructor, {}, or the structure field access operator, ., to index into a function.
  
[color=red]Error: File: filename Line: # Column: # Indexing expressions cannot return multiple results.[/color]   There is an assignment in which the left-hand side takes multiple values, but the right-hand side is not a function call but rather a structure access. For example:
  
[x, y] = f(z) % Correct  
[x, y] = f.z % Incorrect
  
[color=red]Error: File: filename Line: # Column: # Invalid multiple left-hand-side assignment.[/color]   For example, you try to assign to constants
  
[] = sin(1);% Incorrect
  
[color=red]Error: File: filename Line: # Column: # MATLAB assignment cannot be nested. [/color]   You cannot use a syntax such as x = y = 2. Use y = 2, x = y instead.
  
[color=red]Error: File: filename Line: # Column: # Missing operator, comma, or semicolon. [/color]   There is a syntax error in the file. Syntactically, an operator, a comma, or a semicolon is expected, but is missing. For example:
  
if x == y, z = w; end % Correct  
if x == y, z = w end % Incorrect
  
[color=red]Error: File: filename Line: # Column: # Missing variable or function.[/color]   An illegal name was used for a variable or function. For example:
  
x   % Correct  
_x  % Incorrect
  
[color=red]Error: File: filename Line: # Column: # Only functions can return multiple values.[/color]   In this example, foo must be a function, it cannot be a variable.
  
[a, b] = foo;
  
[color=red]Error: File: filename Line: # Column: # "string1" expected, "string2" found. [/color]   There is a syntax error in the specified line. See the online MATLAB Function Reference pages accessible from the Help browser.
  
[color=red]Error: File: filename Line: # Column: # The end operator can only be used within an array index expression. [/color]   You can use the end operator in an array index expression such as sum(A( :, end)). You cannot use the end operator outside of such an expression, for example: y = 1 + end.
  
[color=red]Error: File: filename Line: # Column: # The name "parametername" occurs twice as an input parameter.[/color]   The variable names specified on the function declaration line must be unique. For example:
  
function foo(bar1, bar2)% Correct
function foo(bar, bar)% Incorrect
  
[color=red]Error: File: filename Line: # Column: # The name "parametername" occurs twice as an output parameter.[/color]   The variable names specified on the function declaration line must be unique. For example:
  
function [bar1, bar2] = foo% Correct
function [bar, bar] = foo% Incorrect
  
[color=red]Error: File: filename Line: # Column: # The "operatorname" operator may only produce a single output.[/color]   The primitive operator produces only a single output. For example:
  
x = 1:10; % Correct  
[x, y] = 1:10; % Incorrect
  
[color=red]Error: File: filename Line: # Column: # The PERSISTENT declaration must precede any use of the variable variablename.[/color]   In the text of the function, there is a reference to the variable before the persistent declaration.
  
[color=red]Error: File: filename Line: # Column: # The single colon operator ( : ) can only be used within an array index expression.[/color]   You can only use the : operator by itself as an array index. For example: A( : ) = 5; is okay, but y = :; is not.
  
[color=red]Error: File: filename Line: # Column: # The variable variablename was mentioned more than once as an input. [/color]   The argument list has a repeated variable. For example:
  
function y = myfun(x, x) % Incorrect
  
[color=red]Error: File: filename Line: # Column: # The variable variablename was mentioned more than once as an output.[/color]   The return value vector has a repeated variable. For example:
  
function [x, x] = myfun(y) % Incorrect
  
[color=red]Error: File: filename Line: # Column: # This statement is incomplete. Variable arguments cannot be made global or persistent.[/color]   The variables varargin and varargout are not like other variables. They cannot be declared either global or persistent. For example:
  
global varargin % Incorrect
  
[color=red]Error: File: filename Line: # Column: # Variable argument (varargin) must be last in input argument list.[/color]   The function call must specify the required arguments first followed by varargin. For example:  
  
function [out1, out2] = example1(a, b, varargin)% Correct
function [out1, out2] = example1(a, varargin, b)% Incorrect
  
[color=red]Error: File: filename Line: # Column: # Variable argument (varargout) must be last in output argument list.[/color]   The function call must specify the required arguments first followed by varargout. For example:  
  
function [i, j, varargout]= ex2(x1, y1, x2, y2, val)% Correct
function [i, varargout, j]= ex2(x1, y1, x2, y2, val)% Incorrect
  
[color=red]Error: File: filename Line: # Column: # variablename has been declared both as GLOBAL and PERSISTENT.[/color]   Declare variables as either global or persistent.
  
[color=red]Error: Found illegal whitespace character in command line option: "string". The strings on the left and right side of the space should be separate arguments to MCC.[/color]   For example:
  
mcc('-A', 'none')% Correct
mcc('-A none')% Incorrect
  
[color=red]Error: Improper usage of option -optionname. Type "mcc -?" for usage information.[/color]   You have incorrectly used a Compiler option. For more information about Compiler options, see MATLAB Compiler Option Flags or type mcc -? at the command prompt.
  
[color=red]Error: "languagename" is not a known language.[/color]   The dialect option was given a language argument for which there is no support yet. For example:
  
mcc -m -D japanese sample.m % Correct  
mcc -m -D german sample.m % Incorrect
  
[color=red]Error: libraryname library not found.[/color]   MATLAB has been installed incorrectly.
  
[color=red]Error: MEX-File "mexfilename" cannot be compiled into P-Code. [/color]   Only M-files can be compiled into P-code; MEX-files cannot be compiled into P-code.
  
[color=red]Error: No source files were specified (-? for help).[/color]   You must provide the Compiler with the name of the source file(s) to compile.
  
[color=red]Error: On UNIX, the name of an MLIB-file must begin with the letters "lib". 'filename' does not adhere to this rule.[/color]   The mlib file specified on the command line does not start with the letters "lib" and the file being compiled uses procedures in that library.
  
[color=red]Error: "optionname" is not a valid -option option argument.[/color]   You must use an argument that corresponds to the option. For example:  
  
mcc -L Cpp ...% Correct
mcc -L COBOL ...% Incorrect
  
[color=red]Error: Out of memory.[/color]   Typically, this message occurs because the Compiler requests a larger segment of memory from the operating system than is currently available. Adding additional memory to your system could alleviate this problem.
  
[color=red]Error: Previous warning treated as error. [/color]   When you use the -w error option, this error displays immediately after a warning message.
  
[color=red]Error: The argument after the -option option must contain a colon. [/color]   The format for this argument requires a colon. For more information, see MATLAB Compiler Option Flags or type mcc -? at the command prompt.
  
[color=red]Error: The environment variable MATLAB must be set to the MATLAB root directory. [/color]   On UNIX, the MATLAB and LM_LICENSE_FILE variables must be set. The mcc shell script does this automatically when it is called the first time.
  
[color=red]Error: The file filename cannot be written.[/color]   When generating an mlib file, the Compiler cannot write out the mlib file.
  
[color=red]Error: The license manager failed to initialize (error code is errornumber).[/color]   You do not have a valid Compiler license or no additional Compiler licenses are available.
  
[color=red]Error: The option -option is invalid in modename mode (specify -? for help). [/color]   The specified option is not available.
  
[color=red]Error: The option -option must be immediately followed by whitespace (e.g. "proper_example_usage").[/color]   These options require additional information, so they cannot be combined.  
  
-A, -B, -d, -f, -F, -I, -L, -M, -o, -T, -u, -W, -x, -y, -Y, -z
  
For example, you can use mcc -vc, but you cannot use mcc -Ac annotation:all.
  
Error: The options specified will not generate any output files.[color=red]
Please use one of the following options to generate an executable output file:
    -x (generates a MEX-file executable using C)
    -m (generates a stand-alone executable using C)
    -p (generates a stand-alone executable using C++)
    -S (generates a Simulink MEX S-function using C)
-B sgl (generates a stand-alone graphics library executable using C (requires the SGL))
-B sglcpp (generates a stand-alone graphics library executable using C++ (requires the SGL))
-B pcode (generates a MATLAB P-code file)
    Or type mcc -? for more usage information.[/color]   Use one of these options or another option that generates an output file(s). See MATLAB Compiler Option Flags or type mcc -? at the command prompt for more information.
  
[color=red]Error: The specified file "filename" cannot be read.[/color]   There is a problem with your specified file. For example, the file is not readable because there is no read permission.
  
[color=red]Error: The -option option cannot be combined with other options. [/color]   The -V2.0 option must appear separate from other options on the command line. For example:
  
mcc -V2.0 -L Cpp ...% Correct
mcc -V2.0L Cpp ...% Incorrect
  
[color=red]Error: The -optionname option requires an argument [/color] (e.g. "proper_example_usage").   You have incorrectly used a Compiler option. For more information about Compiler options, see MATLAB Compiler Option Flags or type mcc -? at the command prompt.
  
[color=red]Error: This version of MCC does not support the creation of C++ MEX code. [/color]   You cannot create C++ MEX functions with the current Compiler.
  
[color=red]Error: Unable to open file "filename":<string>. [/color]   There is a problem with your specified file. For example, there is no write permission to the output directory, or the disk is full.
  
[color=red]Error: Unable to set license linger interval (error code is errornumber). [/color]   A license manager failure has occurred. Contact Technical Support at The MathWorks with the full text of the error message.
  
[color=red]Error: Uninterpretable number of inputs set on command line "commandline".[/color]   When generating a Simulink S-function, the inputs specified on the command line was not a number. For example:
  
mcc -S -u 2 sample.m % Correct  
mcc -S -u a sample.m % Incorrect
  
[color=red]Error: Uninterpretable number of outputs set on command line "commandline".[/color]   When generating a Simulink S-function, the outputs specified on the command line was not a number. For example:
  
mcc -S -y 2 sample.m % Correct  
mcc -S -y a sample.m % Incorrect
  
[color=red]Error: Uninterpretable width set on command line "commandline".[/color]   The argument to the page width option was not interpretable as a number.
  
[color=red]Error: Unknown annotation option: optionname.[/color]   An invalid string was specified after the -A option. For a complete list of the valid annotation options, see MATLAB Compiler Option Flags or type mcc -? at the command prompt.
  
[color=red]Error: Unknown typesetting option: optionname.[/color]   The valid typesetting options available with -F are expression-indent:n, list, page-width, and statement-indent:n.
  
[color=red]Error: Unknown warning enable/disable string: warningstring.[/color]   -w enable:, -w disable:, and -w error: require you to use one of the warning string identifiers listed in the Warning Messages.
  
[color=red]Error: Unrecognized option: -option.[/color]   The option is not one of the valid options for this version of the Compiler. See MATLAB Compiler Option Flags for a complete list of valid options for MATLAB Compiler 3.0 or type mcc -? at the command prompt.
  
[color=red]Error: Use "-V2.0" to specify desired version.[/color]   You specified -V without a version number. You must use -V2.0 if you specify a version number.
  
[color=red]Error: versionnumber is not a valid version number. Use "-V2.0".[/color]   If you specify a Compiler version number, it must be -V2.0. The default is -V2.0. 

这篇关于compiler錯誤訊息與解決方式(MATLAB)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/459693

相关文章

内核启动时减少log的方式

内核引导选项 内核引导选项大体上可以分为两类:一类与设备无关、另一类与设备有关。与设备有关的引导选项多如牛毛,需要你自己阅读内核中的相应驱动程序源码以获取其能够接受的引导选项。比如,如果你想知道可以向 AHA1542 SCSI 驱动程序传递哪些引导选项,那么就查看 drivers/scsi/aha1542.c 文件,一般在前面 100 行注释里就可以找到所接受的引导选项说明。大多数选项是通过"_

用命令行的方式启动.netcore webapi

用命令行的方式启动.netcore web项目 进入指定的项目文件夹,比如我发布后的代码放在下面文件夹中 在此地址栏中输入“cmd”,打开命令提示符,进入到发布代码目录 命令行启动.netcore项目的命令为:  dotnet 项目启动文件.dll --urls="http://*:对外端口" --ip="本机ip" --port=项目内部端口 例: dotnet Imagine.M

深入理解RxJava:响应式编程的现代方式

在当今的软件开发世界中,异步编程和事件驱动的架构变得越来越重要。RxJava,作为响应式编程(Reactive Programming)的一个流行库,为Java和Android开发者提供了一种强大的方式来处理异步任务和事件流。本文将深入探讨RxJava的核心概念、优势以及如何在实际项目中应用它。 文章目录 💯 什么是RxJava?💯 响应式编程的优势💯 RxJava的核心概念

【即时通讯】轮询方式实现

技术栈 LayUI、jQuery实现前端效果。django4.2、django-ninja实现后端接口。 代码仓 - 后端 代码仓 - 前端 实现功能 首次访问页面并发送消息时需要设置昵称发送内容为空时要提示用户不能发送空消息前端定时获取消息,然后展示在页面上。 效果展示 首次发送需要设置昵称 发送消息与消息展示 提示用户不能发送空消息 后端接口 发送消息 DB = []@ro

脏页的标记方式详解

脏页的标记方式 一、引言 在数据库系统中,脏页是指那些被修改过但还未写入磁盘的数据页。为了有效地管理这些脏页并确保数据的一致性,数据库需要对脏页进行标记。了解脏页的标记方式对于理解数据库的内部工作机制和优化性能至关重要。 二、脏页产生的过程 当数据库中的数据被修改时,这些修改首先会在内存中的缓冲池(Buffer Pool)中进行。例如,执行一条 UPDATE 语句修改了某一行数据,对应的缓

matlab读取NC文件(含group)

matlab读取NC文件(含group): NC文件数据结构: 代码: % 打开 NetCDF 文件filename = 'your_file.nc'; % 替换为你的文件名% 使用 netcdf.open 函数打开文件ncid = netcdf.open(filename, 'NC_NOWRITE');% 查看文件中的组% 假设我们想读取名为 "group1" 的组groupName

利用matlab bar函数绘制较为复杂的柱状图,并在图中进行适当标注

示例代码和结果如下:小疑问:如何自动选择合适的坐标位置对柱状图的数值大小进行标注?😂 clear; close all;x = 1:3;aa=[28.6321521955954 26.2453660695847 21.69102348512086.93747104431360 6.25442246899816 3.342835958564245.51365061796319 4.87

Java 多线程的基本方式

Java 多线程的基本方式 基础实现两种方式: 通过实现Callable 接口方式(可得到返回值):

前端form表单+ifarme方式实现大文件下载

// main.jsimport Vue from 'vue';import App from './App.vue';import { downloadTokenFile } from '@/path/to/your/function'; // 替换为您的函数路径// 将 downloadTokenFile 添加到 Vue 原型上Vue.prototype.$downloadTokenF

SigLIP——采用sigmoid损失的图文预训练方式

SigLIP——采用sigmoid损失的图文预训练方式 FesianXu 20240825 at Wechat Search Team 前言 CLIP中的infoNCE损失是一种对比性损失,在SigLIP这个工作中,作者提出采用非对比性的sigmoid损失,能够更高效地进行图文预训练,本文进行介绍。如有谬误请见谅并联系指出,本文遵守CC 4.0 BY-SA版权协议,转载请联系作者并注