<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235397</link>
    <title>MATLAB Central Newsreader - compile rosenbrock from c/c++</title>
    <description>Feed for thread: compile rosenbrock from c/c++</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 01 Sep 2008 15:07:01 -0400</pubDate>
      <title>compile rosenbrock from c/c++</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235397#598213</link>
      <author>Dave Brackett</author>
      <description>I have downloaded some code in c or c++ for the Rosenbrock &lt;br&gt;
optimization algorithm. According to the website, &quot;the code &lt;br&gt;
of the optimizer is standard C and doesn't use any special &lt;br&gt;
libraries&quot;, but it may be c++ as the file extension &lt;br&gt;
is .cpp. The website is: &lt;br&gt;
&lt;a href=&quot;http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.ht&quot;&gt;http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.ht&lt;/a&gt;&lt;br&gt;
ml&lt;br&gt;
&lt;br&gt;
I am trying to compile it for use in Matlab, but get the &lt;br&gt;
following error:&lt;br&gt;
&lt;br&gt;
C:\DOCUME~1\mmdjb\LOCALS~1\Temp\mex_JB2Rpz\rosenbrock.obj  &lt;br&gt;
LINK : error LNK2001: unresolved external symbol &lt;br&gt;
mexFunction &lt;br&gt;
C:\DOCUME~1\mmdjb\LOCALS~1\Temp\mex_JB2Rpz\templib.x : &lt;br&gt;
fatal error LNK1120: 1 unresolved externals &lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link &lt;br&gt;
of 'rosenbrock.mexw64' failed. &lt;br&gt;
&amp;nbsp;&lt;br&gt;
??? Error using ==&amp;gt; mex at 207&lt;br&gt;
Unable to complete successfully.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Can anyone else compile it successfully, and if so, how? &lt;br&gt;
Thanks.&lt;br&gt;
&lt;br&gt;
p.s. I am trying to compile it on a 64 bit windows xp &lt;br&gt;
system using Matlab 7.6.0 R2008a</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 20:39:52 -0400</pubDate>
      <title>Re: compile rosenbrock from c/c++</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235397#598235</link>
      <author>James Tursa</author>
      <description>On Mon, 1 Sep 2008 15:07:01 +0000 (UTC), &quot;Dave Brackett&quot;&lt;br&gt;
&amp;lt;davebrackett@hotmail.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;I have downloaded some code in c or c++ for the Rosenbrock &lt;br&gt;
&amp;gt;optimization algorithm. According to the website, &quot;the code &lt;br&gt;
&amp;gt;of the optimizer is standard C and doesn't use any special &lt;br&gt;
&amp;gt;libraries&quot;, but it may be c++ as the file extension &lt;br&gt;
&amp;gt;is .cpp. The website is: &lt;br&gt;
&amp;gt;&lt;a href=&quot;http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.ht&quot;&gt;http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.ht&lt;/a&gt;&lt;br&gt;
&amp;gt;ml&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;I am trying to compile it for use in Matlab, but get the &lt;br&gt;
&amp;gt;following error:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;C:\DOCUME~1\mmdjb\LOCALS~1\Temp\mex_JB2Rpz\rosenbrock.obj  &lt;br&gt;
&amp;gt;LINK : error LNK2001: unresolved external symbol &lt;br&gt;
&amp;gt;mexFunction &lt;br&gt;
&amp;gt;C:\DOCUME~1\mmdjb\LOCALS~1\Temp\mex_JB2Rpz\templib.x : &lt;br&gt;
&amp;gt;fatal error LNK1120: 1 unresolved externals &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link &lt;br&gt;
&amp;gt;of 'rosenbrock.mexw64' failed. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;??? Error using ==&amp;gt; mex at 207&lt;br&gt;
&amp;gt;Unable to complete successfully.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;Can anyone else compile it successfully, and if so, how? &lt;br&gt;
&amp;gt;Thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;p.s. I am trying to compile it on a 64 bit windows xp &lt;br&gt;
&amp;gt;system using Matlab 7.6.0 R2008a&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
The error you are getting means that you have not included the gateway&lt;br&gt;
mexFunction interface to the code. Sounds like you have never used mex&lt;br&gt;
before. My suggestion is to first review the MATLAB help for&lt;br&gt;
mexFunction, then review the help for how to work with mxArray&lt;br&gt;
variables inside a C / C++ program. Then work on writing code to&lt;br&gt;
convert the prhs inputs to C / C++ variables, and then how to convert&lt;br&gt;
your C / C++ variable outputs to plhs variables. Only after you have&lt;br&gt;
done all that will you have a working mex function. If I get some time&lt;br&gt;
later on today I will cook up an example for you using your code.&lt;br&gt;
&lt;br&gt;
doc on mexFunction:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/apiref/mexfunction.html&amp;http://www.mathworks.com/cgi-bin/texis/webinator/search/?db=MSS&amp;prox=page&amp;rorder=750&amp;rprox=750&amp;rdfreq=500&amp;rwfreq=500&amp;rlead=250&amp;sufs=0&amp;order=r&amp;is_summary_on=1&amp;ResultCount=10&amp;query=mexFunction&amp;submitButtonName=Search&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/apiref/mexfunction.html&amp;http://www.mathworks.com/cgi-bin/texis/webinator/search/?db=MSS&amp;prox=page&amp;rorder=750&amp;rprox=750&amp;rdfreq=500&amp;rwfreq=500&amp;rlead=250&amp;sufs=0&amp;order=r&amp;is_summary_on=1&amp;ResultCount=10&amp;query=mexFunction&amp;submitButtonName=Search&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Wed, 03 Sep 2008 08:37:01 -0400</pubDate>
      <title>Re: compile rosenbrock from c/c++</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235397#598462</link>
      <author>Dave Brackett</author>
      <description>James Tursa &amp;lt;aclassyguywithaknotac@hotmail.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;psjob4l5fv4uk4tt0krncap25didf8f3k6@4ax.com&amp;gt;...&lt;br&gt;
&amp;gt; On Mon, 1 Sep 2008 15:07:01 +0000 (UTC), &quot;Dave Brackett&quot;&lt;br&gt;
&amp;gt; &amp;lt;davebrackett@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;I have downloaded some code in c or c++ for the &lt;br&gt;
Rosenbrock &lt;br&gt;
&amp;gt; &amp;gt;optimization algorithm. According to the website, &quot;the &lt;br&gt;
code &lt;br&gt;
&amp;gt; &amp;gt;of the optimizer is standard C and doesn't use any &lt;br&gt;
special &lt;br&gt;
&amp;gt; &amp;gt;libraries&quot;, but it may be c++ as the file extension &lt;br&gt;
&amp;gt; &amp;gt;is .cpp. The website is: &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;&lt;a href=&quot;http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.h&quot;&gt;http://iridia.ulb.ac.be/~fvandenb/optimization/rosenbrock.h&lt;/a&gt;&lt;br&gt;
t&lt;br&gt;
&amp;gt; &amp;gt;ml&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;I am trying to compile it for use in Matlab, but get the &lt;br&gt;
&amp;gt; &amp;gt;following error:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;C:\DOCUME~1\mmdjb\LOCALS~1&lt;br&gt;
\Temp\mex_JB2Rpz\rosenbrock.obj  &lt;br&gt;
&amp;gt; &amp;gt;LINK : error LNK2001: unresolved external symbol &lt;br&gt;
&amp;gt; &amp;gt;mexFunction &lt;br&gt;
&amp;gt; &amp;gt;C:\DOCUME~1\mmdjb\LOCALS~1\Temp\mex_JB2Rpz\templib.x : &lt;br&gt;
&amp;gt; &amp;gt;fatal error LNK1120: 1 unresolved externals &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;  C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link &lt;br&gt;
&amp;gt; &amp;gt;of 'rosenbrock.mexw64' failed. &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;??? Error using ==&amp;gt; mex at 207&lt;br&gt;
&amp;gt; &amp;gt;Unable to complete successfully.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;Can anyone else compile it successfully, and if so, how? &lt;br&gt;
&amp;gt; &amp;gt;Thanks.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;p.s. I am trying to compile it on a 64 bit windows xp &lt;br&gt;
&amp;gt; &amp;gt;system using Matlab 7.6.0 R2008a&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The error you are getting means that you have not &lt;br&gt;
included the gateway&lt;br&gt;
&amp;gt; mexFunction interface to the code. Sounds like you have &lt;br&gt;
never used mex&lt;br&gt;
&amp;gt; before. My suggestion is to first review the MATLAB help &lt;br&gt;
for&lt;br&gt;
&amp;gt; mexFunction, then review the help for how to work with &lt;br&gt;
mxArray&lt;br&gt;
&amp;gt; variables inside a C / C++ program. Then work on writing &lt;br&gt;
code to&lt;br&gt;
&amp;gt; convert the prhs inputs to C / C++ variables, and then &lt;br&gt;
how to convert&lt;br&gt;
&amp;gt; your C / C++ variable outputs to plhs variables. Only &lt;br&gt;
after you have&lt;br&gt;
&amp;gt; done all that will you have a working mex function. If I &lt;br&gt;
get some time&lt;br&gt;
&amp;gt; later on today I will cook up an example for you using &lt;br&gt;
your code.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; doc on mexFunction:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/index.&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/index.&lt;/a&gt;&lt;br&gt;
html?/access/helpdesk/help/techdoc/apiref/mexfunction.html&amp;h&lt;br&gt;
ttp://www.mathworks.com/cgi-bin/texis/webinator/search/?&lt;br&gt;
db=MSS&amp;prox=page&amp;rorder=750&amp;rprox=750&amp;rdfreq=500&amp;rwfreq=500&amp;&lt;br&gt;
rlead=250&amp;sufs=0&amp;order=r&amp;is_summary_on=1&amp;ResultCount=10&amp;quer&lt;br&gt;
y=mexFunction&amp;submitButtonName=Search&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; James Tursa&lt;br&gt;
&lt;br&gt;
i thought i had replied to this but it seems to have gone, &lt;br&gt;
strange. i have used mex before to compile a .c file which &lt;br&gt;
uses the BLAS and LAPACK libraries and that was pretty &lt;br&gt;
straightforward. I have never written gateway code though &lt;br&gt;
and have no experience with C++, so if you could provide an &lt;br&gt;
example relevant to the Rosenbrock code above that would be &lt;br&gt;
really helpful. Thanks.</description>
    </item>
  </channel>
</rss>

