[ADMB Users] Redirecting compilation output

Arni Magnusson arnima at hafro.is
Tue Jun 15 17:59:28 PDT 2010


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)

becomes:

   init_vector Y(1, nobs)

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

   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.

Arni





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
>


More information about the Users mailing list