|
James Tursa <aclassyguywithaknotac@hotmail.com> wrote in
message <psjob4l5fv4uk4tt0krncap25didf8f3k6@4ax.com>...
> On Mon, 1 Sep 2008 15:07:01 +0000 (UTC), "Dave Brackett"
> <davebrackett@hotmail.com> wrote:
>
> >I have downloaded some code in c or c++ for the
Rosenbrock
> >optimization algorithm. According to the website, "the
code
> >of the optimizer is standard C and doesn't use any
special
> >libraries", but it may be c++ as the file extension
> >is .cpp. The website is:
>
>http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.h
t
> >ml
> >
> >I am trying to compile it for use in Matlab, but get the
> >following error:
> >
> >C:\DOCUME~1\mmdjb\LOCALS~1
\Temp\mex_JB2Rpz\rosenbrock.obj
> >LINK : error LNK2001: unresolved external symbol
> >mexFunction
> >C:\DOCUME~1\mmdjb\LOCALS~1\Temp\mex_JB2Rpz\templib.x :
> >fatal error LNK1120: 1 unresolved externals
> >
> > C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link
> >of 'rosenbrock.mexw64' failed.
> >
> >??? Error using ==> mex at 207
> >Unable to complete successfully.
> >
> >
> >Can anyone else compile it successfully, and if so, how?
> >Thanks.
> >
> >p.s. I am trying to compile it on a 64 bit windows xp
> >system using Matlab 7.6.0 R2008a
> >
>
> The error you are getting means that you have not
included the gateway
> mexFunction interface to the code. Sounds like you have
never used mex
> before. My suggestion is to first review the MATLAB help
for
> mexFunction, then review the help for how to work with
mxArray
> variables inside a C / C++ program. Then work on writing
code to
> convert the prhs inputs to C / C++ variables, and then
how to convert
> your C / C++ variable outputs to plhs variables. Only
after you have
> done all that will you have a working mex function. If I
get some time
> later on today I will cook up an example for you using
your code.
>
> doc on mexFunction:
>
>
http://www.mathworks.com/access/helpdesk/help/techdoc/index.
html?/access/helpdesk/help/techdoc/apiref/mexfunction.html&h
ttp://www.mathworks.com/cgi-bin/texis/webinator/search/?
db=MSS&prox=page&rorder=750&rprox=750&rdfreq=500&rwfreq=500&
rlead=250&sufs=0&order=r&is_summary_on=1&ResultCount=10&quer
y=mexFunction&submitButtonName=Search
>
> James Tursa
i thought i had replied to this but it seems to have gone,
strange. i have used mex before to compile a .c file which
uses the BLAS and LAPACK libraries and that was pretty
straightforward. I have never written gateway code though
and have no experience with C++, so if you could provide an
example relevant to the Rosenbrock code above that would be
really helpful. Thanks.
|