在Mathematica中使用多个软件包和参考来构建应用程序软件包 [英] Building Application Packages with multple packages and references in Mathematica
问题描述
我正在Mathematica中构建一个应用程序包.该应用程序包含多个程序包,并且引用了其他应用程序包
I am building an application package in Mathematica. The application contains multiple packages and refers to other application packages
要进行所有设置,我使用并遵循了工作台帮助部分的应用程序包说明,该说明也可在以下位置找到:
To set everything up, I have used and followed the application packages instructions of the help section of workbench which is also available at:http://reference.wolfram.com/workbench/index.jsp?topic=/com.wolfram.eclipse.help/html/tasks/applications/introduction.html under the Packages and Applications subsection but...
- 我已经实现并测试了单个程序包应用程序包,并且所有程序似乎都工作正常.
- 由于以下已发现的问题,我的多个软件包和应用程序目前无法正常工作: a)应用程序的主程序包调用在附加程序包中实现的函数,但是这些函数似乎在此处无法识别.我什至尝试在包开始时使用Needs命令在主包中显式调用它们,但无济于事. * 我在做什么错了? *在帮助指导下,多余的软件包都在应用程序文件夹中. 更具体地说:
- I have implemented and tested single package application packages and the all seem to work fine.
- My Multiple packages and application is not working fine at this moment because of the following identified problems: a) the main package of the application calls functions implemented in the extra packages, but these function seem not to be recognized there. I have tried even to explicitly call them in the main package using the Needs command at the beginning of the package with no avail. *What am I doing wrong?*The extra packages are all in the application folder as the help directs to do. More specifically:
主程序包和应用程序名为OptMainFuncAll`,因此主程序包OptMainFuncAll.m以
The main package and the application are named OptMainFuncAll` so the main package OptMainFuncAll.m begins with
BeginPackage["OptMainFuncAll`"]
额外的软件包IntermFunct.m和VolCandExt.m开头为:
The extra packages IntermFunct.m and VolCandExt.m begin with:
BeginPackage[ "OptMainFuncAll`IntermFunct`"]
BeginPackage[ "QuadOptMainFuncAll`VolCandExt`"]
在IntermFunct.m和VolCandExt.m中定义的函数在 中被调用时是 unknown OptMainFuncAll.m -我在做什么错了?
Yet functions defined in IntermFunct.m and VolCandExt.m are are unknown when called for in OptMainFuncAll.m -- What am I doing wrong?
我什至尝试过明确声明
Needs[ "OptMainFuncAll`IntermFunct`"]
Needs[ "QuadOptMainFuncAll`VolCandExt`"]
在OptMainFuncAll.m的开头,它没有解决我的问题
at the beginning of OptMainFuncAll.m and it has not solved my problem
此外,我已经引用了第二个应用程序包(BasicSym),工作台将其显示为已引用,但它的功能在OptMainFuncAll.m中似乎还是未知的.
In addition I have made a reference to a second application package (BasicSym )and workbench shows it as referenced, but its functions also seem unknown in OptMainFuncAll.m .
我还尝试了以
BeginPackage[{OptMainFuncAll`, BasicSym`}]
,它不起作用;控制台在运行时返回消息:
and it did not work; the console at run times returns the message:
BeginPackage :: cxt:无效的上下文 在位置1中指定 BeginPackage [{OptMainFuncAll
, BasicSym
}].上下文必须包含 有效符号名称,以和分隔 以`结尾. EndPackage :: noctx:否 先前的上下文已定义.
BeginPackage::cxt: Invalid context specified at position 1 in BeginPackage[{OptMainFuncAll
, BasicSym
}]. A context must consist of valid symbol names separated by and ending with `. EndPackage::noctx: No previous context defined.
我确定我在犯一些愚蠢的应用程序包开发人员错误,但似乎无法把手放在上面.
I am sure I am making some stupid application package developer mistake, but I can't seem to put my hand on it.
如果您能在BeginPackage [?]中告诉我主程序包的确切程序包声明,具有我在此处提供的名称的所有程序包和引用程序包的名称,以使所有程序都能正常工作,我将不胜感激.
If you can just tell me the exact package declarations in BeginPackage[?] for the main package, the extra packages and the referenced packages with the names I provided here for everything to work smoothly, i'd greatly appreciate.
推荐答案
请尝试:
BeginPackage["OptMainFuncAll`",
{"BasicSym`",
"OptMainFuncAll`IntermFunct`",
"QuadOptMainFuncAll`VolCandExt`"}
]
当前软件包名称是第一个参数,而第二个参数是它将依赖的软件包名称(上下文)列表.
The current package name is the first argument, while the second argument is a list of package names (contexts) that it will depend upon.
这篇关于在Mathematica中使用多个软件包和参考来构建应用程序软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!