AW: [ECOS] Mixing cpp and c
Jones, Michael
Michael.Jones@distefora-protec.de
Sun Aug 18 07:25:00 GMT 2002
Well thanks!!
Some things are so simple :-( the i386-elf tools entry in the path was included at the end of the path. So the i386-elf-gcc grabed the first g++ that it could find - which I would have never expected (I rather expected that a tool would stick to subcomponents of the same prefix and hince would go for the i386-elf-g++). So now things work....
Thanks again!!!
regard,
Michael
> -----Ursprüngliche Nachricht-----
> Von: Bart Veer [ mailto:bartv@ecoscentric.com ]
> Gesendet: Samstag, 17. August 2002 21:21
> An: Jones, Michael
> Cc: ecos-discuss@sources.redhat.com
> Betreff: Re: [ECOS] Mixing cpp and c
>
>
> >>>>> "Michael" == Jones, Michael
> <Michael.Jones@distefora-protec.de> writes:
>
> Michael> I've got a little problem here.
>
> Michael> I've got a few .cpp files that I would like to add to my
> Michael> (currently entirely .c) project (Target i386). They
> Michael> compile alright but I can't access any function from the
> Michael> ecos library.
>
> Michael> I get messages like:
>
> Michael> .../screen.cpp:213: undefined reference to
> `_diag_init_putc'
>
> Michael> When looking into the object file I find that the '_'
> Michael> underscore is added for the .cpp compiled file and not
> Michael> for the .c files. I've checked the documentation of the
> Michael> gcc and I did find a switch with which I can deactivate
> Michael> the underscore but this seem to be ignored. Also I find
> Michael> that the .cpp files compile to a coff-i386 object format
> Michael> whereas the .c files compile to elf32-i386...
>
> Michael> Now, as I have seen that a few of you are busy using .cpp
> Michael> in there project I would like to ask you if you could
> Michael> lend me your professional advice on this regards. ;-)
> Michael> Perhaps a working makefile???
>
> I think you need to look carefully at the tools you are using. If you
> followed the installation instructions for x86 target then IIRC you
> should have ended up building compilers i386-elf-gcc and i386-elf-g++,
> plus the appropriate support tools like the linker and debugger. Those
> are the tools that will get used to build eCos (unless you start
> manipulating the configuration option CYGBLD_GLOBAL_COMMAND_PREFIX).
> Your own application code should be built with exactly the same tools.
>
> The mention of coff-i386 suggests that you may be using the cygwin
> native g++ compiler for compiling your eCos application code, rather
> than i386-elf-g++. Windows uses its own object format PE, but that is
> based on coff format.
>
> If you use the right tools consistently then there are no problems
> mixing C++ and C code, subject to correct use of extern "C"
> directives.
>
> Bart
>
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list