1<html lang="en"> 2<head> 3<title>windres - GNU Binary Utilities</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="GNU Binary Utilities"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="windmc.html#windmc" title="windmc"> 9<link rel="next" href="dlltool.html#dlltool" title="dlltool"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1991-2013 Free Software Foundation, Inc. 13 14Permission is granted to copy, distribute and/or modify this document 15under the terms of the GNU Free Documentation License, Version 1.3 16or any later version published by the Free Software Foundation; 17with no Invariant Sections, with no Front-Cover Texts, and with no 18Back-Cover Texts. A copy of the license is included in the 19section entitled ``GNU Free Documentation License''. 20 21--> 22<meta http-equiv="Content-Style-Type" content="text/css"> 23<style type="text/css"><!-- 24 pre.display { font-family:inherit } 25 pre.format { font-family:inherit } 26 pre.smalldisplay { font-family:inherit; font-size:smaller } 27 pre.smallformat { font-family:inherit; font-size:smaller } 28 pre.smallexample { font-size:smaller } 29 pre.smalllisp { font-size:smaller } 30 span.sc { font-variant:small-caps } 31 span.roman { font-family:serif; font-weight:normal; } 32 span.sansserif { font-family:sans-serif; font-weight:normal; } 33--></style> 34<link rel="stylesheet" type="text/css" href="../cs.css"> 35</head> 36<body> 37<div class="node"> 38<a name="windres"></a> 39<p> 40Next: <a rel="next" accesskey="n" href="dlltool.html#dlltool">dlltool</a>, 41Previous: <a rel="previous" accesskey="p" href="windmc.html#windmc">windmc</a>, 42Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 43<hr> 44</div> 45 46<h2 class="chapter">13 windres</h2> 47 48<p><samp><span class="command">windres</span></samp> may be used to manipulate Windows resources. 49 50 <blockquote> 51<em>Warning:</em> <samp><span class="command">windres</span></samp> is not always built as part of the binary 52utilities, since it is only useful for Windows targets. 53</blockquote> 54 55<!-- man title windres manipulate Windows resources. --> 56<pre class="smallexample"> <!-- man begin SYNOPSIS windres --> 57 windres [options] [input-file] [output-file] 58 <!-- man end --> 59</pre> 60 <!-- man begin DESCRIPTION windres --> 61 <p><samp><span class="command">windres</span></samp> reads resources from an input file and copies them into 62an output file. Either file may be in one of three formats: 63 64 <dl> 65<dt><code>rc</code><dd>A text format read by the Resource Compiler. 66 67 <br><dt><code>res</code><dd>A binary format generated by the Resource Compiler. 68 69 <br><dt><code>coff</code><dd>A COFF object or executable. 70</dl> 71 72 <p>The exact description of these different formats is available in 73documentation from Microsoft. 74 75 <p>When <samp><span class="command">windres</span></samp> converts from the <code>rc</code> format to the <code>res</code> 76format, it is acting like the Windows Resource Compiler. When 77<samp><span class="command">windres</span></samp> converts from the <code>res</code> format to the <code>coff</code> 78format, it is acting like the Windows <code>CVTRES</code> program. 79 80 <p>When <samp><span class="command">windres</span></samp> generates an <code>rc</code> file, the output is similar 81but not identical to the format expected for the input. When an input 82<code>rc</code> file refers to an external filename, an output <code>rc</code> file 83will instead include the file contents. 84 85 <p>If the input or output format is not specified, <samp><span class="command">windres</span></samp> will 86guess based on the file name, or, for the input file, the file contents. 87A file with an extension of <samp><span class="file">.rc</span></samp> will be treated as an <code>rc</code> 88file, a file with an extension of <samp><span class="file">.res</span></samp> will be treated as a 89<code>res</code> file, and a file with an extension of <samp><span class="file">.o</span></samp> or 90<samp><span class="file">.exe</span></samp> will be treated as a <code>coff</code> file. 91 92 <p>If no output file is specified, <samp><span class="command">windres</span></samp> will print the resources 93in <code>rc</code> format to standard output. 94 95 <p>The normal use is for you to write an <code>rc</code> file, use <samp><span class="command">windres</span></samp> 96to convert it to a COFF object file, and then link the COFF file into 97your application. This will make the resources described in the 98<code>rc</code> file available to Windows. 99 100<!-- man end --> 101<!-- man begin OPTIONS windres --> 102 <dl> 103<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 104<samp><span class="command">windres</span></samp> will use the first non-option argument as the input file 105name. If there are no non-option arguments, then <samp><span class="command">windres</span></samp> will 106read from standard input. <samp><span class="command">windres</span></samp> can not read a COFF file from 107standard input. 108 109 <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 110<samp><span class="command">windres</span></samp> will use the first non-option argument, after any used 111for the input file name, as the output file name. If there is no 112non-option argument, then <samp><span class="command">windres</span></samp> will write to standard output. 113<samp><span class="command">windres</span></samp> can not write a COFF file to standard output. Note, 114for compatibility with <samp><span class="command">rc</span></samp> the option <samp><span class="option">-fo</span></samp> is also 115accepted, but its use is not recommended. 116 117 <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 118‘<samp><span class="samp">coff</span></samp>’. If no input format is specified, <samp><span class="command">windres</span></samp> will 119guess, as described above. 120 121 <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>’, 122‘<samp><span class="samp">rc</span></samp>’, or ‘<samp><span class="samp">coff</span></samp>’. If no output format is specified, 123<samp><span class="command">windres</span></samp> will guess, as described above. 124 125 <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 126is a BFD target name; you can use the <samp><span class="option">--help</span></samp> option to see a list 127of supported targets. Normally <samp><span class="command">windres</span></samp> will use the default 128format, which is the first one listed by the <samp><span class="option">--help</span></samp> option. 129<a href="Target-Selection.html#Target-Selection">Target Selection</a>. 130 131 <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 132preprocessor first. This option may be used to specify the preprocessor 133to use, including any leading arguments. The default preprocessor 134argument is <code>gcc -E -xc-header -DRC_INVOKED</code>. 135 136 <br><dt><samp><span class="env">--preprocessor-arg </span><var>option</var></samp><dd>When <samp><span class="command">windres</span></samp> reads an <code>rc</code> file, it runs it through 137the C preprocessor first. This option may be used to specify additional 138text to be passed to preprocessor on its command line. 139This option can be used multiple times to add multiple options to the 140preprocessor command line. 141 142 <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. 143<samp><span class="command">windres</span></samp> will pass this to the preprocessor as an <samp><span class="option">-I</span></samp> 144option. <samp><span class="command">windres</span></samp> will also search this directory when looking for 145files named in the <code>rc</code> file. If the argument passed to this command 146matches any of the supported <var>formats</var> (as described in the <samp><span class="option">-J</span></samp> 147option), it will issue a deprecation warning, and behave just like the 148<samp><span class="option">-J</span></samp> option. New programs should not use this behaviour. If a 149directory happens to match a <var>format</var>, simple prefix it with ‘<samp><span class="samp">./</span></samp>’ 150to disable the backward compatibility. 151 152 <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 153<code>rc</code> file. 154 155 <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 156<code>rc</code> file. 157 158 <br><dt><samp><span class="env">-r</span></samp><dd>Ignored for compatibility with rc. 159 160 <br><dt><samp><span class="env">-v</span></samp><dd>Enable verbose mode. This tells you what the preprocessor is if you 161didn't specify one. 162 163 <br><dt><samp><span class="env">-c </span><var>val</var></samp><br><dt><samp><span class="env">--codepage </span><var>val</var></samp><dd>Specify the default codepage to use when reading an <code>rc</code> file. 164<var>val</var> should be a hexadecimal prefixed by ‘<samp><span class="samp">0x</span></samp>’ or decimal 165codepage code. The valid range is from zero up to 0xffff, but the 166validity of the codepage is host and configuration dependent. 167 168 <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. 169<var>val</var> should be a hexadecimal language code. The low eight bits are 170the language, and the high eight bits are the sublanguage. 171 172 <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 173the preprocessor. Use this option if the popen implementation is buggy 174on the host (eg., certain non-English language versions of Windows 95 and 175Windows 98 are known to have buggy popen where the output will instead 176go the console). 177 178 <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. 179This is the default behaviour. 180 181 <br><dt><samp><span class="env">-h</span></samp><br><dt><samp><span class="env">--help</span></samp><dd>Prints a usage summary. 182 183 <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>. 184 185 <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>, 186this will turn on parser debugging. 187</dl> 188 189<!-- man end --> 190 </body></html> 191 192