You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

278 lines
12 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1991-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".
-->
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>windres (GNU Binary Utilities)</title>
<meta name="description" content="windres (GNU Binary Utilities)">
<meta name="keywords" content="windres (GNU Binary Utilities)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="dlltool.html#dlltool" rel="next" title="dlltool">
<link href="windmc.html#windmc" rel="prev" title="windmc">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="windres"></a>
<div class="header">
<p>
Next: <a href="dlltool.html#dlltool" accesskey="n" rel="next">dlltool</a>, Previous: <a href="windmc.html#windmc" accesskey="p" rel="prev">windmc</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="windres-1"></a>
<h2 class="chapter">12 windres</h2>
<p><code>windres</code> may be used to manipulate Windows resources.
</p>
<blockquote>
<p><em>Warning:</em> <code>windres</code> is not always built as part of the binary
utilities, since it is only useful for Windows targets.
</p></blockquote>
<div class="smallexample">
<pre class="smallexample">windres [options] [input-file] [output-file]
</pre></div>
<p><code>windres</code> reads resources from an input file and copies them into
an output file. Either file may be in one of three formats:
</p>
<dl compact="compact">
<dt><code>rc</code></dt>
<dd><p>A text format read by the Resource Compiler.
</p>
</dd>
<dt><code>res</code></dt>
<dd><p>A binary format generated by the Resource Compiler.
</p>
</dd>
<dt><code>coff</code></dt>
<dd><p>A COFF object or executable.
</p></dd>
</dl>
<p>The exact description of these different formats is available in
documentation from Microsoft.
</p>
<p>When <code>windres</code> converts from the <code>rc</code> format to the <code>res</code>
format, it is acting like the Windows Resource Compiler. When
<code>windres</code> converts from the <code>res</code> format to the <code>coff</code>
format, it is acting like the Windows <code>CVTRES</code> program.
</p>
<p>When <code>windres</code> 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>
<p>If the input or output format is not specified, <code>windres</code> will
guess based on the file name, or, for the input file, the file contents.
A file with an extension of <samp>.rc</samp> will be treated as an <code>rc</code>
file, a file with an extension of <samp>.res</samp> will be treated as a
<code>res</code> file, and a file with an extension of <samp>.o</samp> or
<samp>.exe</samp> will be treated as a <code>coff</code> file.
</p>
<p>If no output file is specified, <code>windres</code> will print the resources
in <code>rc</code> format to standard output.
</p>
<p>The normal use is for you to write an <code>rc</code> file, use <code>windres</code>
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.
</p>
<dl compact="compact">
<dt><code>-i <var>filename</var></code></dt>
<dt><code>--input <var>filename</var></code></dt>
<dd><p>The name of the input file. If this option is not used, then
<code>windres</code> will use the first non-option argument as the input file
name. If there are no non-option arguments, then <code>windres</code> will
read from standard input. <code>windres</code> can not read a COFF file from
standard input.
</p>
</dd>
<dt><code>-o <var>filename</var></code></dt>
<dt><code>--output <var>filename</var></code></dt>
<dd><p>The name of the output file. If this option is not used, then
<code>windres</code> 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 <code>windres</code> will write to standard output.
<code>windres</code> can not write a COFF file to standard output. Note,
for compatibility with <code>rc</code> the option <samp>-fo</samp> is also
accepted, but its use is not recommended.
</p>
</dd>
<dt><code>-J <var>format</var></code></dt>
<dt><code>--input-format <var>format</var></code></dt>
<dd><p>The input format to read. <var>format</var> may be &lsquo;<samp>res</samp>&rsquo;, &lsquo;<samp>rc</samp>&rsquo;, or
&lsquo;<samp>coff</samp>&rsquo;. If no input format is specified, <code>windres</code> will
guess, as described above.
</p>
</dd>
<dt><code>-O <var>format</var></code></dt>
<dt><code>--output-format <var>format</var></code></dt>
<dd><p>The output format to generate. <var>format</var> may be &lsquo;<samp>res</samp>&rsquo;,
&lsquo;<samp>rc</samp>&rsquo;, or &lsquo;<samp>coff</samp>&rsquo;. If no output format is specified,
<code>windres</code> will guess, as described above.
</p>
</dd>
<dt><code>-F <var>target</var></code></dt>
<dt><code>--target <var>target</var></code></dt>
<dd><p>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>--help</samp> option to see a list
of supported targets. Normally <code>windres</code> will use the default
format, which is the first one listed by the <samp>--help</samp> option.
<a href="Target-Selection.html#Target-Selection">Target Selection</a>.
</p>
</dd>
<dt><code>--preprocessor <var>program</var></code></dt>
<dd><p>When <code>windres</code> 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>.
</p>
</dd>
<dt><code>--preprocessor-arg <var>option</var></code></dt>
<dd><p>When <code>windres</code> reads an <code>rc</code> file, it runs it through
the C preprocessor first. This option may be used to specify additional
text to be passed to preprocessor on its command line.
This option can be used multiple times to add multiple options to the
preprocessor command line.
</p>
</dd>
<dt><code>-I <var>directory</var></code></dt>
<dt><code>--include-dir <var>directory</var></code></dt>
<dd><p>Specify an include directory to use when reading an <code>rc</code> file.
<code>windres</code> will pass this to the preprocessor as an <samp>-I</samp>
option. <code>windres</code> 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 described in the <samp>-J</samp>
option), it will issue a deprecation warning, and behave just like the
<samp>-J</samp> option. New programs should not use this behaviour. If a
directory happens to match a <var>format</var>, simple prefix it with &lsquo;<samp>./</samp>&rsquo;
to disable the backward compatibility.
</p>
</dd>
<dt><code>-D <var>target</var></code></dt>
<dt><code>--define <var>sym</var>[=<var>val</var>]</code></dt>
<dd><p>Specify a <samp>-D</samp> option to pass to the preprocessor when reading an
<code>rc</code> file.
</p>
</dd>
<dt><code>-U <var>target</var></code></dt>
<dt><code>--undefine <var>sym</var></code></dt>
<dd><p>Specify a <samp>-U</samp> option to pass to the preprocessor when reading an
<code>rc</code> file.
</p>
</dd>
<dt><code>-r</code></dt>
<dd><p>Ignored for compatibility with rc.
</p>
</dd>
<dt><code>-v</code></dt>
<dd><p>Enable verbose mode. This tells you what the preprocessor is if you
didn&rsquo;t specify one.
</p>
</dd>
<dt><code>-c <var>val</var></code></dt>
<dt><code>--codepage <var>val</var></code></dt>
<dd><p>Specify the default codepage to use when reading an <code>rc</code> file.
<var>val</var> should be a hexadecimal prefixed by &lsquo;<samp>0x</samp>&rsquo; or decimal
codepage code. The valid range is from zero up to 0xffff, but the
validity of the codepage is host and configuration dependent.
</p>
</dd>
<dt><code>-l <var>val</var></code></dt>
<dt><code>--language <var>val</var></code></dt>
<dd><p>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.
</p>
</dd>
<dt><code>--use-temp-file</code></dt>
<dd><p>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).
</p>
</dd>
<dt><code>--no-use-temp-file</code></dt>
<dd><p>Use popen, not a temporary file, to read the output of the preprocessor.
This is the default behaviour.
</p>
</dd>
<dt><code>-h</code></dt>
<dt><code>--help</code></dt>
<dd><p>Prints a usage summary.
</p>
</dd>
<dt><code>-V</code></dt>
<dt><code>--version</code></dt>
<dd><p>Prints the version number for <code>windres</code>.
</p>
</dd>
<dt><code>--yydebug</code></dt>
<dd><p>If <code>windres</code> is compiled with <code>YYDEBUG</code> defined as <code>1</code>,
this will turn on parser debugging.
</p></dd>
</dl>
<hr>
<div class="header">
<p>
Next: <a href="dlltool.html#dlltool" accesskey="n" rel="next">dlltool</a>, Previous: <a href="windmc.html#windmc" accesskey="p" rel="prev">windmc</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>