Clear Filters
Clear Filters

Problem compiling wtih Matlab Builder for JA: "Unable to determine function name or input/output argument count for function in M-file ..."

2 views (last 30 days)
Dear all, I am encountering an error message when compiling a couple of functions into a class with the Matlab Builder for JA toolbox. The entire error message follows:
ant:
<mkdir dir="C:\Documents and Settings\mrv1z07\My Documents\My Dropbox\CALLBACKS\matlabOptim_project\distrib" />
<mkdir dir="C:\Documents and Settings\mrv1z07\My Documents\My Dropbox\CALLBACKS\matlabOptim_project\src" />
mcc -W java:matlabOptim_project,matlabOptimClass -T link:lib -d 'C:\Documents and Settings\mrv1z07\My Documents\My Dropbox\CALLBACKS\matlabOptim_project\src' -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -S -v class{matlabOptimClass:C:\OPTIMAT\development\CALLBACKS\randomVars.m,C:\OPTIMAT\development\CALLBACKS\randomVars_noAPI.m,C:\OPTIMAT\development\CALLBACKS\test.m}
MATLAB:I18n:InconsistentLocale - The system locale setting, en_US.1252, is different from the user locale setting, en_GB.1252.
Compiler version: 4.13 (R2010a)
Processing include files...
2 item(s) added.
Processing directories installed with MCR...
The file C:\Documents and Settings\mrv1z07\My Documents\My Dropbox\CALLBACKS\matlabOptim_project\src\mccExcludedFiles.log contains a list of functions excluded from the CTF archive.
2 item(s) added.
Generating MATLAB path for the compiled application...
Created 39 path items.
Begin validation of MEX files: Fri Aug 05 13:32:47 2011
End validation of MEX files: Fri Aug 05 13:32:47 2011
Warning: Duplicate directory name: C:\OPTIMAT\development\CALLBACKS.
Warning: Duplicate directory name: C:\OPTIMAT\development\CALLBACKS.
Parsing file "C:\OPTIMAT\development\CALLBACKS\randomVars.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\OPTIMAT\development\CALLBACKS\randomVars_noAPI.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\OPTIMAT\development\CALLBACKS\test.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2010a\toolbox\compiler\deploy\deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2010a\toolbox\compiler\deploy\printdlg.m"
(Referenced from: "Compiler Command Line").
Unable to determine function name or input/output argument count for function
in M-file "C:\OPTIMAT\development\CALLBACKS\randomVars.m".
Please use MLINT to determine if this file contains errors.
I have used MLINT on both functions, and they are both fine (warnings, but no errors).
I found a similar support question here:
But the answer is not the right one for my problem, my license is fine and testing the compiler with a very simple test function worked fine.
So I am wondering if anyone can shed some light into the meaning of this error.
Here's a bit more info: * Matlab 2010a * JAVA 1.6 * One function calls a simple JAVA class of my own, which has been added to the javaclasspath. * The other function calls another of my JAVA classes, this one a bit more complex because it uses some other program's API classes that will not work until executed properly, but have been imported to the javaclasspath and also they have been put in a try catch block to avoid errors when the execption is caught.
I tried with the first of the two functions only, the one that doesn't use the API classes, but the same error was thrown when compiling (only the function name changed).
Any ideas? I'd be very grateful.
Kind regards Maria
  2 Comments
Maria
Maria on 5 Aug 2011
Certainly.
function [err] = randomVars(iters,nvars)
% To test simple callbacks to java class, version 2.
%import com.engineous.sdk.*;
import AOTWrapper;
%import
%methodsview('AOTWrapper')
%[M,X,J] = inmem
JO = javaObject('AOTWrapper');
err=0;
if iters==0
err=1;
return;
end
% Create an array of vars.
vars=rand(iters,nvars);
% Need to evaluate the objective function for all the design points. This will be
% evaluated using a simple java function.
for i=1:iters
% Design point
varset=vars(i,:);
%Evaluate design point
try
JO.EvaluateDesign(varset)
catch ME
msg='Java exception caught';
err=2;
end
end

Sign in to comment.

Accepted Answer

Friedrich
Friedrich on 5 Aug 2011
Hi,
thanks for posting. The import AOTWrapper part looks a bit strange. Normally you have to specifiy a bit more when using import. See doc for the correct usage:
When changing to import AOTWrapper.*; it works fine. When keeping it as import AOTWrapper; I get the following error earlier during the build:
Error: File: C:\Users\fhempel\Desktop\tmp\randomVars.m Line: 6 Column: 8 Arguments to IMPORT must either end with ".*" or else specify a fully qualified class name: "AOTWrapper" fails this test.
But the build continues and later I get your error:
ant:<br><ant><br> <mkdir dir="C:\Users\fhempel\Desktop\tmp\Untitled2\distrib" /><br> <mkdir dir="C:\Users\fhempel\Desktop\tmp\Untitled2\src" /><br></ant>
mcc -W 'java:Untitled2,Class1' -T link:lib -d C:\Users\fhempel\Desktop\tmp\Untitled2\src -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -v class{Class1:C:\Users\fhempel\Desktop\tmp\randomVars.m}
Compiler version: 4.15 (R2011a)
Processing C:\Program Files\MATLAB\R2011a\toolbox\matlab\mcc.enc
Error: File: C:\Users\fhempel\Desktop\tmp\randomVars.m Line: 6 Column: 8
Arguments to IMPORT must either end with ".*"
or else specify a fully qualified class name: "AOTWrapper" fails this test.
Processing include files...
2 item(s) added.
Processing directories installed with MCR...
The file C:\Users\fhempel\Desktop\tmp\Untitled2\src\mccExcludedFiles.log contains a list of functions excluded from the CTF archive.
2 item(s) added.
Generating MATLAB path for the compiled application...
Created 40 path items.
Begin validation of MEX files: Fri Aug 05 15:32:51 2011
End validation of MEX files: Fri Aug 05 15:32:51 2011
Parsing file "C:\Users\fhempel\Desktop\tmp\randomVars.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2011a\toolbox\compiler\deploy\deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2011a\toolbox\compiler\deploy\printdlg.m"
(Referenced from: "Compiler Command Line").
Unable to determine function name or input/output argument count for function
in MATLAB file "C:\Users\fhempel\Desktop\tmp\randomVars.m".
Please use MLINT to determine if this file contains errors.
Please check your import statement and try again.
  1 Comment
Maria
Maria on 5 Aug 2011
THANKS! You solved the problem, it compiles fine now.
The thing is, the matlab external user guide specifies the import of a single class that is not within a package by its name, not .*. AOTWrapper.class is a single class that is a in folder that I have added to the javaclasspath, so it should be ok. In fact, I can run it in matlab and mlint finds no issues.
But it seems that the MATLAB Builder for JA thinks differently!
Thank you very much.
Kind regards
maria

Sign in to comment.

More Answers (0)

Categories

Find more on Java Package Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!