[ADMB Users] R2admb compile problem

Allan Clark allan.northpine at gmail.com
Sun Oct 20 22:39:15 PDT 2013


Good morning all (sorry for themultipel postings)



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.



//Function1.tpl

//*********************************

PARAMETER_SECTION

 init_number x;

 objective_function_value C;



PROCEDURE_SECTION

 C=  pow(x-5,2);

//*********************************



I am running the example using three different methods 1. from DOS 2. From
Emacs 3. From within R





1. from DOS

admb Function1

Function1



This runs correctly and works



2. From Emacs



I "Translate", "Build" and "Run" the file and it works correctly



3. From R



#Using the following code



require(R2admb)



fn="Function1"

setup_admb()  #outputs the following [1] "c:\\ADMB\\admb101-gcc452-win64"

compile_admb(fn, verbose=T)

#I set 'verbose =T' to see whats happening #last error line = 'collect2: ld
returned 1 exit status'



#cant run this part of the code

run_admb(fn)



#Error in run_admb(fn) :

#executable Function1.exe not found: did you forget to compile it?





Note that if I first compile the tpl file using DOS and then run the
following from R, that everything works.



run_admb(fn) #to run the executable

results <- read_admb(fn)

results

clean_admb(fn)





DOES ANYONE KNOW WHY compile_admb(fn, verbose=T) DOES NOT WORK CORRECTLY?





//Function1.tpl

DATA_SECTION



PARAMETER_SECTION

 init_number x;

 objective_function_value C;





PRELIMINARY_CALCS_SECTION



PROCEDURE_SECTION



 C=  pow(x-5,2);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20131021/2b28689c/attachment.html>


More information about the Users mailing list