[ADMB Users] Redirecting compilation output

Saang-Yoon Hyun shyun at umassd.edu
Tue Jun 15 18:23:40 PDT 2010

Hello, Arni. 

You are wonderful.  Your description below is great, and EXTREMELY helps me.   I owe you a good Korean dish.  Thank you VERY MUCH.  Best,  


From: "Arni Magnusson" <arnima at hafro.is> 
To: users at admb-project.org 
Cc: "Saang-Yoon Hyun" <shyun at umassd.edu> 
Sent: Tuesday, June 15, 2010 8:59:28 PM 
Subject: Redirecting compilation output 

Hi Saang-Yoon, 

If you want to save the compilation output to text files, then you need to 
consider that there are two different kinds of output: standard output 
(stdout) and errors (stderr). 

To take an example, start with simple.tpl and create a bug by inserting an 
extra space, so 

   init_vector Y(1,nobs) 


   init_vector Y(1, nobs) 

Now compile and redirect the standard output to 'one.txt' and errors to 

   admb simple > one.txt 2> two.txt 

This is not new behavior. It works the same in Windows and Linux, and is 
not related to ADMB-IDE or the new compilation scripts. This behavior is 
in fact older than Windows and Linux. 

If you want to do this from within Emacs, you can run shell-command, 
either by typing M-x shell-command (that's Alt-x) or by pressing M-! 
(that's Alt-Shift-1) and then type: 

   admb simple > one.txt 2> two.txt 

If you find yourself using shell-command on a regular basis, it is easy to 
bind it to a more accessible keystroke, such as M-1 or the like. You can 
also open a shell inside Emacs using M-x shell, or just open a regular 
shell outside of Emacs. 

If you want to redirect compilation output all the time, you could write a 
new function admb-build-redirect (almost identical to admb-build) and bind 
that to a keystroke like S-f8. 

Emacs is designed for people like you, Saang-Yoon. Demanding customers. 


On Tue, 15 Jun 2010, Saang-Yoon Hyun wrote: 

> Hello, ADMB folks. 
> While I have been using ADMB-IDE, I find something different in compile 
> output. In older versions of ADMB, I used to print compile outputs 
> mainly to catch errors by using the following command in a DOS window 
> (i.e., Command window). 
> makadmb ABC > compileout.txt 
> where "makadmb" is compile-link command in an older version, "ABC" is a 
> TPL file, and "compileout.txt" is an arbitrary name. Then all outputs 
> including errors in CPP file (i.e., ABC.cpp) are shown in the 
> "compileout.txt" file. 
> In ADMB-IDE, I did the same thing like 
> admb ABC > compileout.txt 
> where "admb" is compile-link command in ADMB-IDE version. However, 
> outputs of errors in CPP file are never included in the "compileout.txt" 
> file. Interestingly all outputs only except errors in CPP file are shown 
> in the "compileout.txt" file. 
> What and how should I do to have the output file (compileout.txt) show 
> all errors as in before? I find that Emacs editor with ADMB-IDE shows 
> the error outputs, but I feel more comfortable with DOS commands. I 
> cannot open a DOS window directly from the Emacs editor, except for 
> "shell command". But the "shell command" in Emacs does not stay and 
> disappears after every command execution, thus the "shell command" does 
> not seem helpful to a person who like DOS commands. 
> I would greatly appreciate your advice. 
> Saang-Yoon 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20100615/be39fc5f/attachment.html>

More information about the Users mailing list