[ADMB Users] R2admb compile problem

Allan Clark allan.clark at uct.ac.za
Sun Oct 20 03:13:58 PDT 2013


Good morning all

I am trying to use R2admb and have the following very simple example. 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);
________________________________
 UNIVERSITY OF CAPE TOWN

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.




More information about the Users mailing list