<div dir="ltr">
<p class="MsoNormal"><span style>Good morning all (sorry for themultipel postings)<br></span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>I am trying to use R2admb and have the
following very simple example (just to test if things are working). The *.tpl is included below. I am a Windows 7
user, using R3.01.</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>//Function1.tpl</span></p>
<p class="MsoNormal"><span style>//*********************************</span></p>
<p class="MsoNormal"><span style>PARAMETER_SECTION</span></p>
<p class="MsoNormal"><span style><span style> </span>init_number x;</span></p>
<p class="MsoNormal"><span style><span style> </span>objective_function_value C;</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>PROCEDURE_SECTION</span></p>
<p class="MsoNormal"><span style><span style> </span>C=<span style>
</span>pow(x-5,2);</span></p>
<p class="MsoNormal"><span style>//*********************************</span></p>
<p class="MsoNormal"><span style><span style> </span></span></p>
<p class="MsoNormal"><span style>I am running the example using three
different methods 1. from DOS 2. From Emacs 3. From within R</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>1. from DOS</span></p>
<p class="MsoNormal"><span style>admb Function1</span></p>
<p class="MsoNormal"><span style>Function1</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>This runs correctly and works</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>2. From Emacs</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>I "Translate",
"Build" and "Run" the file and it works correctly</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>3. From R</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>#Using the following code</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>require(R2admb)</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>fn="Function1"</span></p>
<p class="MsoNormal"><span style>setup_admb()<span style> </span>#outputs the following [1]
"c:\\ADMB\\admb101-gcc452-win64"</span></p>
<p class="MsoNormal"><span style>compile_admb(fn, verbose=T)</span></p>
<p class="MsoNormal"><span style>#I set 'verbose =T' to see whats
happening #last error line = 'collect2: ld returned 1 exit status'</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>#cant run this part of the code</span></p>
<p class="MsoNormal"><span style>run_admb(fn) </span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>#Error in run_admb(fn) : </span></p>
<p class="MsoNormal"><span style>#executable Function1.exe not found: did
you forget to compile it?</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>Note that if I first compile the tpl
file using DOS and then run the following from R, that everything works.</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>run_admb(fn) #to run the executable</span></p>
<p class="MsoNormal"><span style>results <- read_admb(fn)</span></p>
<p class="MsoNormal"><span style>results</span></p>
<p class="MsoNormal"><span style>clean_admb(fn)</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>DOES ANYONE KNOW WHY compile_admb(fn,
verbose=T) DOES NOT WORK CORRECTLY?</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>//Function1.tpl</span></p>
<p class="MsoNormal"><span style>DATA_SECTION</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>PARAMETER_SECTION</span></p>
<p class="MsoNormal"><span style><span style> </span>init_number x;</span></p>
<p class="MsoNormal"><span style><span style> </span>objective_function_value C;</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style><span style> </span></span></p>
<p class="MsoNormal"><span style>PRELIMINARY_CALCS_SECTION</span></p>
<p class="MsoNormal"><span style> </span></p>
<p class="MsoNormal"><span style>PROCEDURE_SECTION</span></p>
<p class="MsoNormal"><span style><span style> </span></span></p>
<p class="MsoNormal"><span style><span style> </span>C=<span style>
</span>pow(x-5,2);</span></p>
<p class="MsoNormal"> </p>
</div>