Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller.gnilink.net!gnilink.net!trnddc05.POSTED!702e7bde!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: compile rosenbrock from c/c++
Message-ID: <psjob4l5fv4uk4tt0krncap25didf8f3k6@4ax.com>
References: <g9h0el$ong$1@fred.mathworks.com>
X-Newsreader: Forte Agent 3.3/32.846
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 49
Date: Mon, 01 Sep 2008 20:39:52 GMT
NNTP-Posting-Host: 71.112.96.193
X-Complaints-To: abuse@verizon.net
X-Trace: trnddc05 1220301592 71.112.96.193 (Mon, 01 Sep 2008 16:39:52 EDT)
NNTP-Posting-Date: Mon, 01 Sep 2008 16:39:52 EDT
Bytes: 2944
X-Original-Bytes: 2901
Xref: news.mathworks.com comp.soft-sys.matlab:488136



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.ht
>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&http://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&query=mexFunction&submitButtonName=Search

James Tursa