|
|
Undefined function or method in compiled program - but function file is within CTF
Hi,
I run into this (and similar) problems when running my compiled program:
Undefined function or method 'DoSetupSlider' for input arguments of type 'struct'.
Error in ==> DoSetup at 87
Error in ==> Main>Main_OpeningFcn at 46
Error in ==> gui_mainfcn at 221
Error in ==> Main at 18
However, the extracted CTF archive clearly reveals a file named DoSetupSlider.m next to DoSetup.m. This is the contents of DoSetupSlider.m:
function DoSetupSlider(handles, Scale)
handles.XAxisSliderScale = Scale([1, end]);
guidata(handles.MainFigure, handles);
xlim(handles.PlotArea, Scale([1, end]));
DoUpdateSlider(handles);
end
The call in DoSetup.m, line 87, is the following:
DoSetupSlider(handles, [0, 1]);
Now I don't see any reason why this should fail. It fails with R2009b using lcc-win32 on Windows XP SP3, and it also fails with R2010b using Microsoft Visual C++ 2010 on Windows 7 SP1 (different physical system). So, I do not think it is related to any software or hardware configuration thing. I compiled using the basic deploytool settings. I also tried to explicitly include all .m files using the -a switch equivalent in the deploytool.
Any help would be greatly appreciated.
Thanks,
Yannick
|
|
0
|
|
|
|
Reply
|
Yannick
|
2/28/2011 7:45:46 PM |
|
"Yannick " <bers.remove.this@gmx.net> wrote in message <ikgu1a$phn$1@fred.mathworks.com>...
> Undefined function or method 'DoSetupSlider' for input arguments of type 'struct'.
> ...
> However, the extracted CTF archive clearly reveals a file named DoSetupSlider.m next to DoSetup.m. This is the contents of DoSetupSlider.m:
I found a reduction which really strikes me. Consider the following example (TestMain.m):
---
mfile = mfilename('fullpath');
disp(mfile);
path = fileparts(mfile);
disp(path);
TestSub;
cd(path)
TestSub;
---
TestSub is a function m file only displaying "works", and is stored in the folder next to the current TestMain.m.
Now, compiling this file and running it results in the expected output (using TestMain.exe 1> log.txt):
--
D:\Temp\xxx\mcrCache7.14\Untitl2\Sort\TestMain
D:\Temp\xxx\mcrCache7.14\Untitl2\Sort
works
works
--
Now, commenting out only the first call to TestSub and compiling again, we find this on stdout:
--
D:\Temp\xxx\mcrCache7.14\Untitl5\Untitled1\TestMain
D:\Temp\xxx\mcrCache7.14\Untitl5\Untitled1
--
and this on stderr
--
Undefined function or variable 'TestSub'.
MATLAB:UndefinedFunction
--
I consider this an inconsistent behavior and thus a bug - does anyone disagree?
Yannick
|
|
0
|
|
|
|
Reply
|
bers.remove.this (31)
|
3/4/2011 12:29:06 AM
|
|
"Yannick " <bers.remove.this@gmx.net> wrote in message
news:ikpboi$ibr$1@fred.mathworks.com...
*snip*
> I consider this an inconsistent behavior and thus a bug - does anyone
> disagree?
You should send a full description of these reproduction steps for this
behavior to Technical Support so they can investigate and determine why this
occurs and whether or not it's a bug.
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|
|
0
|
|
|
|
Reply
|
slord (13285)
|
3/5/2011 3:36:07 AM
|
|
"Steven_Lord" <slord@mathworks.com> wrote in message <iksb2p$4sr$1@fred.mathworks.com>...
> You should send a full description of these reproduction steps for this
> behavior to Technical Support so they can investigate and determine why this
> occurs and whether or not it's a bug.
I did, and it looks as if it was confirmed as unwanted behavior. A workaround seems to be to use a function m file rather than a script file for TestMain, although the example code they sent back to me also uses a script file instead of a function file for TestSub. So either one of these solutions, or both combined, might hopefully be helpful to others experiencing the same issue.
|
|
0
|
|
|
|
Reply
|
bers.remove.this (31)
|
3/9/2011 10:42:03 PM
|
|
|
3 Replies
691 Views
(page loaded in 0.102 seconds)
|
|
|
|
|
|
|
|
|