1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Copyright (C) 1991-2021 Free Software Foundation, Inc.
4
5Permission is granted to copy, distribute and/or modify this document
6under the terms of the GNU Free Documentation License, Version 1.3
7or any later version published by the Free Software Foundation;
8with no Invariant Sections, with no Front-Cover Texts, and with no
9Back-Cover Texts.  A copy of the license is included in the
10section entitled "GNU Free Documentation License".
11 -->
12<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
13<head>
14<title>GNU Binary Utilities: windres</title>
15
16<meta name="description" content="GNU Binary Utilities: windres">
17<meta name="keywords" content="GNU Binary Utilities: windres">
18<meta name="resource-type" content="document">
19<meta name="distribution" content="global">
20<meta name="Generator" content="makeinfo">
21<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
22<link href="index.html#Top" rel="start" title="Top">
23<link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
24<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
25<link href="index.html#Top" rel="up" title="Top">
26<link href="dlltool.html#dlltool" rel="next" title="dlltool">
27<link href="windmc.html#windmc" rel="previous" title="windmc">
28<style type="text/css">
29<!--
30a.summary-letter {text-decoration: none}
31blockquote.smallquotation {font-size: smaller}
32div.display {margin-left: 3.2em}
33div.example {margin-left: 3.2em}
34div.indentedblock {margin-left: 3.2em}
35div.lisp {margin-left: 3.2em}
36div.smalldisplay {margin-left: 3.2em}
37div.smallexample {margin-left: 3.2em}
38div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
39div.smalllisp {margin-left: 3.2em}
40kbd {font-style:oblique}
41pre.display {font-family: inherit}
42pre.format {font-family: inherit}
43pre.menu-comment {font-family: serif}
44pre.menu-preformatted {font-family: serif}
45pre.smalldisplay {font-family: inherit; font-size: smaller}
46pre.smallexample {font-size: smaller}
47pre.smallformat {font-family: inherit; font-size: smaller}
48pre.smalllisp {font-size: smaller}
49span.nocodebreak {white-space:nowrap}
50span.nolinebreak {white-space:nowrap}
51span.roman {font-family:serif; font-weight:normal}
52span.sansserif {font-family:sans-serif; font-weight:normal}
53ul.no-bullet {list-style: none}
54-->
55</style>
56
57
58</head>
59
60<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
61<a name="windres"></a>
62<div class="header">
63<p>
64Next: <a href="dlltool.html#dlltool" accesskey="n" rel="next">dlltool</a>, Previous: <a href="windmc.html#windmc" accesskey="p" rel="previous">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>
65</div>
66<hr>
67<a name="windres-1"></a>
68<h2 class="chapter">12 windres</h2>
69
70<p><code>windres</code> may be used to manipulate Windows resources.
71</p>
72<blockquote>
73<p><em>Warning:</em> <code>windres</code> is not always built as part of the binary
74utilities, since it is only useful for Windows targets.
75</p></blockquote>
76
77
78<div class="smallexample">
79<pre class="smallexample">windres [options] [input-file] [output-file]
80</pre></div>
81
82
83<p><code>windres</code> reads resources from an input file and copies them into
84an output file.  Either file may be in one of three formats:
85</p>
86<dl compact="compact">
87<dt><code>rc</code></dt>
88<dd><p>A text format read by the Resource Compiler.
89</p>
90</dd>
91<dt><code>res</code></dt>
92<dd><p>A binary format generated by the Resource Compiler.
93</p>
94</dd>
95<dt><code>coff</code></dt>
96<dd><p>A COFF object or executable.
97</p></dd>
98</dl>
99
100<p>The exact description of these different formats is available in
101documentation from Microsoft.
102</p>
103<p>When <code>windres</code> converts from the <code>rc</code> format to the <code>res</code>
104format, it is acting like the Windows Resource Compiler.  When
105<code>windres</code> converts from the <code>res</code> format to the <code>coff</code>
106format, it is acting like the Windows <code>CVTRES</code> program.
107</p>
108<p>When <code>windres</code> generates an <code>rc</code> file, the output is similar
109but not identical to the format expected for the input.  When an input
110<code>rc</code> file refers to an external filename, an output <code>rc</code> file
111will instead include the file contents.
112</p>
113<p>If the input or output format is not specified, <code>windres</code> will
114guess based on the file name, or, for the input file, the file contents.
115A file with an extension of <samp>.rc</samp> will be treated as an <code>rc</code>
116file, a file with an extension of <samp>.res</samp> will be treated as a
117<code>res</code> file, and a file with an extension of <samp>.o</samp> or
118<samp>.exe</samp> will be treated as a <code>coff</code> file.
119</p>
120<p>If no output file is specified, <code>windres</code> will print the resources
121in <code>rc</code> format to standard output.
122</p>
123<p>The normal use is for you to write an <code>rc</code> file, use <code>windres</code>
124to convert it to a COFF object file, and then link the COFF file into
125your application.  This will make the resources described in the
126<code>rc</code> file available to Windows.
127</p>
128
129
130<dl compact="compact">
131<dt><code>-i <var>filename</var></code></dt>
132<dt><code>--input <var>filename</var></code></dt>
133<dd><p>The name of the input file.  If this option is not used, then
134<code>windres</code> will use the first non-option argument as the input file
135name.  If there are no non-option arguments, then <code>windres</code> will
136read from standard input.  <code>windres</code> can not read a COFF file from
137standard input.
138</p>
139</dd>
140<dt><code>-o <var>filename</var></code></dt>
141<dt><code>--output <var>filename</var></code></dt>
142<dd><p>The name of the output file.  If this option is not used, then
143<code>windres</code> will use the first non-option argument, after any used
144for the input file name, as the output file name.  If there is no
145non-option argument, then <code>windres</code> will write to standard output.
146<code>windres</code> can not write a COFF file to standard output.  Note,
147for compatibility with <code>rc</code> the option <samp>-fo</samp> is also
148accepted, but its use is not recommended.
149</p>
150</dd>
151<dt><code>-J <var>format</var></code></dt>
152<dt><code>--input-format <var>format</var></code></dt>
153<dd><p>The input format to read.  <var>format</var> may be &lsquo;<samp>res</samp>&rsquo;, &lsquo;<samp>rc</samp>&rsquo;, or
154&lsquo;<samp>coff</samp>&rsquo;.  If no input format is specified, <code>windres</code> will
155guess, as described above.
156</p>
157</dd>
158<dt><code>-O <var>format</var></code></dt>
159<dt><code>--output-format <var>format</var></code></dt>
160<dd><p>The output format to generate.  <var>format</var> may be &lsquo;<samp>res</samp>&rsquo;,
161&lsquo;<samp>rc</samp>&rsquo;, or &lsquo;<samp>coff</samp>&rsquo;.  If no output format is specified,
162<code>windres</code> will guess, as described above.
163</p>
164</dd>
165<dt><code>-F <var>target</var></code></dt>
166<dt><code>--target <var>target</var></code></dt>
167<dd><p>Specify the BFD format to use for a COFF file as input or output.  This
168is a BFD target name; you can use the <samp>--help</samp> option to see a list
169of supported targets.  Normally <code>windres</code> will use the default
170format, which is the first one listed by the <samp>--help</samp> option.
171<a href="Target-Selection.html#Target-Selection">Target Selection</a>.
172</p>
173</dd>
174<dt><code>--preprocessor <var>program</var></code></dt>
175<dd><p>When <code>windres</code> reads an <code>rc</code> file, it runs it through the C
176preprocessor first.  This option may be used to specify the preprocessor
177to use, including any leading arguments.  The default preprocessor
178argument is <code>gcc -E -xc-header -DRC_INVOKED</code>.
179</p>
180</dd>
181<dt><code>--preprocessor-arg <var>option</var></code></dt>
182<dd><p>When <code>windres</code> reads an <code>rc</code> file, it runs it through
183the C preprocessor first.  This option may be used to specify additional
184text to be passed to preprocessor on its command line.
185This option can be used multiple times to add multiple options to the
186preprocessor command line.
187</p>
188</dd>
189<dt><code>-I <var>directory</var></code></dt>
190<dt><code>--include-dir <var>directory</var></code></dt>
191<dd><p>Specify an include directory to use when reading an <code>rc</code> file.
192<code>windres</code> will pass this to the preprocessor as an <samp>-I</samp>
193option.  <code>windres</code> will also search this directory when looking for
194files named in the <code>rc</code> file.  If the argument passed to this command
195matches any of the supported <var>formats</var> (as described in the <samp>-J</samp>
196option), it will issue a deprecation warning, and behave just like the
197<samp>-J</samp> option.  New programs should not use this behaviour.  If a
198directory happens to match a <var>format</var>, simple prefix it with &lsquo;<samp>./</samp>&rsquo;
199to disable the backward compatibility.
200</p>
201</dd>
202<dt><code>-D <var>target</var></code></dt>
203<dt><code>--define <var>sym</var>[=<var>val</var>]</code></dt>
204<dd><p>Specify a <samp>-D</samp> option to pass to the preprocessor when reading an
205<code>rc</code> file.
206</p>
207</dd>
208<dt><code>-U <var>target</var></code></dt>
209<dt><code>--undefine <var>sym</var></code></dt>
210<dd><p>Specify a <samp>-U</samp> option to pass to the preprocessor when reading an
211<code>rc</code> file.
212</p>
213</dd>
214<dt><code>-r</code></dt>
215<dd><p>Ignored for compatibility with rc.
216</p>
217</dd>
218<dt><code>-v</code></dt>
219<dd><p>Enable verbose mode.  This tells you what the preprocessor is if you
220didn&rsquo;t specify one.
221</p>
222</dd>
223<dt><code>-c <var>val</var></code></dt>
224<dt><code>--codepage <var>val</var></code></dt>
225<dd><p>Specify the default codepage to use when reading an <code>rc</code> file.
226<var>val</var> should be a hexadecimal prefixed by &lsquo;<samp>0x</samp>&rsquo; or decimal
227codepage code. The valid range is from zero up to 0xffff, but the
228validity of the codepage is host and configuration dependent.
229</p>
230</dd>
231<dt><code>-l <var>val</var></code></dt>
232<dt><code>--language <var>val</var></code></dt>
233<dd><p>Specify the default language to use when reading an <code>rc</code> file.
234<var>val</var> should be a hexadecimal language code.  The low eight bits are
235the language, and the high eight bits are the sublanguage.
236</p>
237</dd>
238<dt><code>--use-temp-file</code></dt>
239<dd><p>Use a temporary file to instead of using popen to read the output of
240the preprocessor. Use this option if the popen implementation is buggy
241on the host (eg., certain non-English language versions of Windows 95 and
242Windows 98 are known to have buggy popen where the output will instead
243go the console).
244</p>
245</dd>
246<dt><code>--no-use-temp-file</code></dt>
247<dd><p>Use popen, not a temporary file, to read the output of the preprocessor.
248This is the default behaviour.
249</p>
250</dd>
251<dt><code>-h</code></dt>
252<dt><code>--help</code></dt>
253<dd><p>Prints a usage summary.
254</p>
255</dd>
256<dt><code>-V</code></dt>
257<dt><code>--version</code></dt>
258<dd><p>Prints the version number for <code>windres</code>.
259</p>
260</dd>
261<dt><code>--yydebug</code></dt>
262<dd><p>If <code>windres</code> is compiled with <code>YYDEBUG</code> defined as <code>1</code>,
263this will turn on parser debugging.
264</p></dd>
265</dl>
266
267
268
269<hr>
270<div class="header">
271<p>
272Next: <a href="dlltool.html#dlltool" accesskey="n" rel="next">dlltool</a>, Previous: <a href="windmc.html#windmc" accesskey="p" rel="previous">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>
273</div>
274
275
276
277</body>
278</html>
279