<html lang="en">
<head>
<title>windres - GNU Binary Utilities</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Binary Utilities">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="nlmconv.html#nlmconv" title="nlmconv">
<link rel="next" href="dlltool.html#dlltool" title="dlltool">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.css");
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="windres"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="dlltool.html#dlltool">dlltool</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="nlmconv.html#nlmconv">nlmconv</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">12 windres</h2>

<p><samp><span class="command">windres</span></samp> may be used to manipulate Windows resources.

   <blockquote>
<em>Warning:</em> <samp><span class="command">windres</span></samp> is not always built as part of the binary
utilities, since it is only useful for Windows targets. 
</blockquote>

<!-- man title windres manipulate Windows resources. -->
<pre class="smallexample">     <!-- man begin SYNOPSIS windres -->
     windres [options] [input-file] [output-file]
     <!-- man end -->
</pre>
   <!-- man begin DESCRIPTION windres -->
<p><samp><span class="command">windres</span></samp> reads resources from an input file and copies them into
an output file.  Either file may be in one of three formats:

     <dl>
<dt><code>rc</code><dd>A text format read by the Resource Compiler.

     <br><dt><code>res</code><dd>A binary format generated by the Resource Compiler.

     <br><dt><code>coff</code><dd>A COFF object or executable. 
</dl>

   <p>The exact description of these different formats is available in
documentation from Microsoft.

   <p>When <samp><span class="command">windres</span></samp> converts from the <code>rc</code> format to the <code>res</code>
format, it is acting like the Windows Resource Compiler.  When
<samp><span class="command">windres</span></samp> converts from the <code>res</code> format to the <code>coff</code>
format, it is acting like the Windows <code>CVTRES</code> program.

   <p>When <samp><span class="command">windres</span></samp> generates an <code>rc</code> file, the output is similar
but not identical to the format expected for the input.  When an input
<code>rc</code> file refers to an external filename, an output <code>rc</code> file
will instead include the file contents.

   <p>If the input or output format is not specified, <samp><span class="command">windres</span></samp> will
guess based on the file name, or, for the input file, the file contents. 
A file with an extension of <samp><span class="file">.rc</span></samp> will be treated as an <code>rc</code>
file, a file with an extension of <samp><span class="file">.res</span></samp> will be treated as a
<code>res</code> file, and a file with an extension of <samp><span class="file">.o</span></samp> or
<samp><span class="file">.exe</span></samp> will be treated as a <code>coff</code> file.

   <p>If no output file is specified, <samp><span class="command">windres</span></samp> will print the resources
in <code>rc</code> format to standard output.

   <p>The normal use is for you to write an <code>rc</code> file, use <samp><span class="command">windres</span></samp>
to convert it to a COFF object file, and then link the COFF file into
your application.  This will make the resources described in the
<code>rc</code> file available to Windows.

<!-- man end -->
<!-- man begin OPTIONS windres -->
<dl>
<dt><samp><span class="env">-i </span><var>filename</var></samp><dt><samp><span class="env">--input </span><var>filename</var></samp><dd>The name of the input file.  If this option is not used, then
<samp><span class="command">windres</span></samp> will use the first non-option argument as the input file
name.  If there are no non-option arguments, then <samp><span class="command">windres</span></samp> will
read from standard input.  <samp><span class="command">windres</span></samp> can not read a COFF file from
standard input.

     <br><dt><samp><span class="env">-o </span><var>filename</var></samp><dt><samp><span class="env">--output </span><var>filename</var></samp><dd>The name of the output file.  If this option is not used, then
<samp><span class="command">windres</span></samp> will use the first non-option argument, after any used
for the input file name, as the output file name.  If there is no
non-option argument, then <samp><span class="command">windres</span></samp> will write to standard output. 
<samp><span class="command">windres</span></samp> can not write a COFF file to standard output.  Note,
for compatability with <samp><span class="command">rc</span></samp> the option <samp><span class="option">-fo</span></samp> is also
accepted, but its use is not recommended.

     <br><dt><samp><span class="env">-J </span><var>format</var></samp><dt><samp><span class="env">--input-format </span><var>format</var></samp><dd>The input format to read.  <var>format</var> may be `<samp><span class="samp">res</span></samp>', `<samp><span class="samp">rc</span></samp>', or
`<samp><span class="samp">coff</span></samp>'.  If no input format is specified, <samp><span class="command">windres</span></samp> will
guess, as described above.

     <br><dt><samp><span class="env">-O </span><var>format</var></samp><dt><samp><span class="env">--output-format </span><var>format</var></samp><dd>The output format to generate.  <var>format</var> may be `<samp><span class="samp">res</span></samp>',
`<samp><span class="samp">rc</span></samp>', or `<samp><span class="samp">coff</span></samp>'.  If no output format is specified,
<samp><span class="command">windres</span></samp> will guess, as described above.

     <br><dt><samp><span class="env">-F </span><var>target</var></samp><dt><samp><span class="env">--target </span><var>target</var></samp><dd>Specify the BFD format to use for a COFF file as input or output.  This
is a BFD target name; you can use the <samp><span class="option">--help</span></samp> option to see a list
of supported targets.  Normally <samp><span class="command">windres</span></samp> will use the default
format, which is the first one listed by the <samp><span class="option">--help</span></samp> option. 
<a href="Target-Selection.html#Target-Selection">Target Selection</a>.

     <br><dt><samp><span class="env">--preprocessor </span><var>program</var></samp><dd>When <samp><span class="command">windres</span></samp> reads an <code>rc</code> file, it runs it through the C
preprocessor first.  This option may be used to specify the preprocessor
to use, including any leading arguments.  The default preprocessor
argument is <code>gcc -E -xc-header -DRC_INVOKED</code>.

     <br><dt><samp><span class="env">-I </span><var>directory</var></samp><dt><samp><span class="env">--include-dir </span><var>directory</var></samp><dd>Specify an include directory to use when reading an <code>rc</code> file. 
<samp><span class="command">windres</span></samp> will pass this to the preprocessor as an <samp><span class="option">-I</span></samp>
option.  <samp><span class="command">windres</span></samp> will also search this directory when looking for
files named in the <code>rc</code> file.  If the argument passed to this command
matches any of the supported <var>formats</var> (as descrived in the <samp><span class="option">-J</span></samp>
option), it will issue a deprecation warning, and behave just like the
<samp><span class="option">-J</span></samp> option.  New programs should not use this behaviour.  If a
directory happens to match a <var>format</var>, simple prefix it with `<samp><span class="samp">./</span></samp>'
to disable the backward compatibility.

     <br><dt><samp><span class="env">-D </span><var>target</var></samp><dt><samp><span class="env">--define </span><var>sym</var><span class="env">[=</span><var>val</var><span class="env">]</span></samp><dd>Specify a <samp><span class="option">-D</span></samp> option to pass to the preprocessor when reading an
<code>rc</code> file.

     <br><dt><samp><span class="env">-U </span><var>target</var></samp><dt><samp><span class="env">--undefine </span><var>sym</var></samp><dd>Specify a <samp><span class="option">-U</span></samp> option to pass to the preprocessor when reading an
<code>rc</code> file.

     <br><dt><samp><span class="env">-r</span></samp><dd>Ignored for compatibility with rc.

     <br><dt><samp><span class="env">-v</span></samp><dd>Enable verbose mode.  This tells you what the preprocessor is if you
didn't specify one.

     <br><dt><samp><span class="env">-l </span><var>val</var></samp><br><dt><samp><span class="env">--language </span><var>val</var></samp><dd>Specify the default language to use when reading an <code>rc</code> file. 
<var>val</var> should be a hexadecimal language code.  The low eight bits are
the language, and the high eight bits are the sublanguage.

     <br><dt><samp><span class="env">--use-temp-file</span></samp><dd>Use a temporary file to instead of using popen to read the output of
the preprocessor. Use this option if the popen implementation is buggy
on the host (eg., certain non-English language versions of Windows 95 and
Windows 98 are known to have buggy popen where the output will instead
go the console).

     <br><dt><samp><span class="env">--no-use-temp-file</span></samp><dd>Use popen, not a temporary file, to read the output of the preprocessor. 
This is the default behaviour.

     <br><dt><samp><span class="env">-h</span></samp><br><dt><samp><span class="env">--help</span></samp><dd>Prints a usage summary.

     <br><dt><samp><span class="env">-V</span></samp><br><dt><samp><span class="env">--version</span></samp><dd>Prints the version number for <samp><span class="command">windres</span></samp>.

     <br><dt><samp><span class="env">--yydebug</span></samp><dd>If <samp><span class="command">windres</span></samp> is compiled with <code>YYDEBUG</code> defined as <code>1</code>,
this will turn on parser debugging. 
</dl>

<!-- man end -->
</body></html>

