OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [user-guide/] [compiling-cpp-app.html] - Blame information for rev 446

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>Compiling a C++ Application</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos User Guide"
20
HREF="ecos-user-guide.html"><LINK
21
REL="UP"
22
TITLE="Compiler and Linker Options"
23
HREF="compiler-and-linker-options.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Compiler and Linker Options"
26
HREF="compiler-and-linker-options.html"><LINK
27
REL="NEXT"
28
TITLE="Debugging Techniques"
29
HREF="debugging-techniques.html"></HEAD
30
><BODY
31
CLASS="SECT1"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos User Guide</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="compiler-and-linker-options.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
>Chapter 26. Compiler and Linker Options</TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="debugging-techniques.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="SECT1"
82
><H1
83
CLASS="SECT1"
84
><A
85
NAME="COMPILING-CPP-APP">Compiling a C++ Application</H1
86
><P
87
>The following command lines demonstrate the
88
          <SPAN
89
CLASS="emphasis"
90
><I
91
CLASS="EMPHASIS"
92
>minimum</I
93
></SPAN
94
> set of options required to
95
          compile and link an <SPAN
96
CLASS="PRODUCTNAME"
97
>eCos</SPAN
98
> program written in C++.
99
        </P
100
><DIV
101
CLASS="NOTE"
102
><BLOCKQUOTE
103
CLASS="NOTE"
104
><P
105
><B
106
>Note: </B
107
>Remember that when this manual shows
108
            <B
109
CLASS="COMMAND"
110
><TT
111
CLASS="REPLACEABLE"
112
><I
113
>TARGET-</I
114
></TT
115
>g++</B
116
>
117
            you should use the full name of the cross compiler,
118
            e.g. <B
119
CLASS="COMMAND"
120
>i386-elf-g++</B
121
>,
122
            <B
123
CLASS="COMMAND"
124
>arm-elf-g++</B
125
>, or
126
            <B
127
CLASS="COMMAND"
128
>sh-elf-g++</B
129
>. When compiling for the
130
            synthetic Linux target, use the native
131
            <B
132
CLASS="COMMAND"
133
>g++</B
134
> which must have the features
135
            required by <SPAN
136
CLASS="PRODUCTNAME"
137
>eCos</SPAN
138
>.</P
139
></BLOCKQUOTE
140
></DIV
141
><TABLE
142
BORDER="5"
143
BGCOLOR="#E0E0F0"
144
WIDTH="70%"
145
><TR
146
><TD
147
><PRE
148
CLASS="SCREEN"
149
>$ <TT
150
CLASS="REPLACEABLE"
151
><I
152
>TARGET-</I
153
></TT
154
>g++ -c  -I<TT
155
CLASS="REPLACEABLE"
156
><I
157
>INSTALL_DIR</I
158
></TT
159
>/include -fno-rtti -fno-exceptions file.cxx
160
$ <TT
161
CLASS="REPLACEABLE"
162
><I
163
>TARGET-</I
164
></TT
165
>g++ -o program file.o -L<TT
166
CLASS="REPLACEABLE"
167
><I
168
>INSTALL_DIR</I
169
></TT
170
>/lib -Ttarget.ld -nostdlib</PRE
171
></TD
172
></TR
173
></TABLE
174
><DIV
175
CLASS="NOTE"
176
><BLOCKQUOTE
177
CLASS="NOTE"
178
><P
179
><B
180
>Note: </B
181
>Certain targets may require extra options,
182
            for example the SPARClite architectures require the option
183
            <TT
184
CLASS="OPTION"
185
>-mcpu=sparclite</TT
186
>. Examine the
187
            <TT
188
CLASS="FILENAME"
189
><TT
190
CLASS="REPLACEABLE"
191
><I
192
>BASE_DIR</I
193
></TT
194
>/packages/targets</TT
195
>
196
            file or <TT
197
CLASS="FILENAME"
198
><TT
199
CLASS="REPLACEABLE"
200
><I
201
>BASE_DIR</I
202
></TT
203
>/examples/Makefile</TT
204
>
205
            or the &#8220;Global compiler flags&#8221; option
206
            (CYGBLD_GLOBAL_CFLAGS) in your generated
207
            <SPAN
208
CLASS="PRODUCTNAME"
209
>eCos</SPAN
210
> configuration) to see if any extra options are
211
            required, and if so, what they are.</P
212
><P
213
>The following command lines use some other options
214
            which are recommended because they use the
215
            <I
216
CLASS="FIRSTTERM"
217
>selective linking</I
218
> feature:</P
219
><TABLE
220
BORDER="5"
221
BGCOLOR="#E0E0F0"
222
WIDTH="70%"
223
><TR
224
><TD
225
><PRE
226
CLASS="SCREEN"
227
>$ <TT
228
CLASS="REPLACEABLE"
229
><I
230
>TARGET-</I
231
></TT
232
>g++ -c -I<TT
233
CLASS="REPLACEABLE"
234
><I
235
>INSTALL_DIR</I
236
></TT
237
>/include -I. -ffunction-sections -fdata-sections -fno-rtti \
238
          -fno-exceptions -finit-priority -g -O2 file.cxx
239
$ <TT
240
CLASS="REPLACEABLE"
241
><I
242
>TARGET-</I
243
></TT
244
>g++ -o program file.o -W1,--gc-sections -g -O2 -L<TT
245
CLASS="REPLACEABLE"
246
><I
247
>INSTALL_DIR</I
248
></TT
249
>/lib -Ttarget.ld  -nostdlib</PRE
250
></TD
251
></TR
252
></TABLE
253
></BLOCKQUOTE
254
></DIV
255
></DIV
256
><DIV
257
CLASS="NAVFOOTER"
258
><HR
259
ALIGN="LEFT"
260
WIDTH="100%"><TABLE
261
SUMMARY="Footer navigation table"
262
WIDTH="100%"
263
BORDER="0"
264
CELLPADDING="0"
265
CELLSPACING="0"
266
><TR
267
><TD
268
WIDTH="33%"
269
ALIGN="left"
270
VALIGN="top"
271
><A
272
HREF="compiler-and-linker-options.html"
273
ACCESSKEY="P"
274
>Prev</A
275
></TD
276
><TD
277
WIDTH="34%"
278
ALIGN="center"
279
VALIGN="top"
280
><A
281
HREF="ecos-user-guide.html"
282
ACCESSKEY="H"
283
>Home</A
284
></TD
285
><TD
286
WIDTH="33%"
287
ALIGN="right"
288
VALIGN="top"
289
><A
290
HREF="debugging-techniques.html"
291
ACCESSKEY="N"
292
>Next</A
293
></TD
294
></TR
295
><TR
296
><TD
297
WIDTH="33%"
298
ALIGN="left"
299
VALIGN="top"
300
>Compiler and Linker Options</TD
301
><TD
302
WIDTH="34%"
303
ALIGN="center"
304
VALIGN="top"
305
><A
306
HREF="compiler-and-linker-options.html"
307
ACCESSKEY="U"
308
>Up</A
309
></TD
310
><TD
311
WIDTH="33%"
312
ALIGN="right"
313
VALIGN="top"
314
>Debugging Techniques</TD
315
></TR
316
></TABLE
317
></DIV
318
></BODY
319
></HTML
320
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.