<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi,<br>
as I suggested in my previous reply - use existing C++ example
(with its makefile) as a c++ template for your project.<br>
Anyway,<br>
here is the output of my makefile (c++ example):<br>
<br>
$ export PATH=/opt/rtems-4.11/bin:$PATH<br>
$ export RTEMS_MAKEFILE_PATH=/opt/rtems-fw/sparc-rtems4.11/sis/<br>
<br>
$make clean all<br>
rm -f a.out core mon.out gmon.out<br>
rm -f -r <br>
rm -f -r a.out *.o *.BAK Depends-o-optimize.tmp<br>
rm -f -r o-optimize o-debug<br>
test -d o-optimize || mkdir o-optimize<br>
sparc-rtems4.11-gcc --pipe
-B/opt/rtems-fw/sparc-rtems4.11/sis/lib/ -specs bsp_specs
-qrtems -g -Wall -O2 -g -g -mcpu=cypress -c -o
o-optimize/init.o init.c<br>
sparc-rtems4.11-g++ -B/opt/rtems-fw/sparc-rtems4.11/sis/lib/
-specs bsp_specs -qrtems -g -Wall -g -mcpu=cypress -c
-o o-optimize/main.o main.cc<br>
sparc-rtems4.11-g++ -B/opt/rtems-fw/sparc-rtems4.11/sis/lib/
-specs bsp_specs -qrtems -g -Wall -g -mcpu=cypress
-mcpu=cypress -o o-optimize/cxx_throw.exe o-optimize/init.o
o-optimize/main.o <br>
sparc-rtems4.11-nm -g -n o-optimize/cxx_throw.exe >
o-optimize/cxx_throw.num<br>
sparc-rtems4.11-size o-optimize/cxx_throw.exe<br>
text data bss dec hex filename<br>
212608 2740 22960 238308 3a2e4
o-optimize/cxx_throw.exe<br>
cp o-optimize/cxx_throw.exe o-optimize/cxx_throw.ralf<br>
<br>
it should help you<br>
<br>
Jiri<br>
<br>
<br>
On 30/10/12 08:47, Luca Cinquepalmi wrote:<br>
</div>
<blockquote cite="mid:508F9404.3050201@planetek.it" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Here I post a simple rtems C++ code
(template.cc) which works if<br>
compiled as a C source file but not as a C++ file.<br>
I'm using sparc-rtems4.11-g++ compiler. Are there particular
compilation<br>
flags I have to use? Is C++ template different from C one?
Thanks a lot<br>
<br>
Luca<br>
-------------------------------------------------------------------------------------------------------------------------<br>
</div>
<small>#define CONFIGURE_INIT<br>
#include "system.h"<br>
#include <cstdlib><br>
<br>
<br>
extern "C" {<br>
rtems_task Init(<br>
rtems_task_argument arg<br>
);<br>
};<br>
<br>
/* Declare rtems tasks */<br>
rtems_task Init (rtems_task_argument argument);
/* Declare entry point */<br>
<br>
#include "define.h"<br>
#include "leon.h"<br>
#include "utils.h"<br>
#include "printSerial.h"<br>
<br>
rtems_task Init (rtems_task_argument argument)<br>
{<br>
printf("MY NAME IS LUCA!\n\r");<br>
rtems_task_delete(RTEMS_SELF);<br>
}</small><br>
-------------------------------------------------------------------------------------------------------------------------<br>
My Makefile flags:<br>
<br>
CXX = sparc-rtems4.11-g++<br>
BSP_PATH = /opt/$(INSTALL_POINT)/sparc-$(CCOMP)/leon2/lib<br>
SPECS_PATH = $(BSP_PATH)/bsp_specs <br>
<br>
LD_LIBS += -lgcc -lm -msoft-float -lrtems++ -lstdc++<br>
LD_PATH += -I../../include/leon -I../include -B$(BSP_PATH) -specs
$(SPECS_PATH)<br>
LDFLAGS += -mcpu=v8 -qrtems<br>
CXXFLAGS += -msoft-float -mcpu=v8 $(LD_PATH) -Wno-write-strings<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rtems-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a>
<a class="moz-txt-link-freetext" href="http://www.rtems.org/mailman/listinfo/rtems-users">http://www.rtems.org/mailman/listinfo/rtems-users</a>
</pre>
</blockquote>
<br>
</body>
</html>