[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: [avr-gcc-list] [Fwd: building gcc/g++]

From: Torsten Mohr
Subject: Re: Fwd: [avr-gcc-list] [Fwd: building gcc/g++]
Date: Sun, 12 May 2002 22:55:57 +0200

Hi everybody,

i was playing around with GCC and its configuration.
I was able to compile GCC for AVR with C++ support,
thanks for that URL to a patch that i got by mail.

In that patch, basically the following things are done:

"configure.in" is patched to add target-libiberty,
${libstdcxx_version} and ${libgcj} to noconfigdirs.

gcc/config/avr/avr.h defines LIBSTDCXX to ""

gcc/cp/g++specs.c adds LIBSTDCXX only if
strlen(LIBSTDCXX) < 0 (NEVER, with that patch in avr.h)

I now started a short test project (at the bottom of this
email).  But sadly it doesn't compile:

avr-g++ -mmcu=avr5 -nostdlib -Wa,-ahslnd=list/main.lst \
-c main.c -o obj/main.o
avr-g++ -mmcu=avr5 -nostdlib -Wa,-ahslnd=list/test.lst \
-c test.cc -o obj/test.o
avr-g++ -mmcu=avr5 -nostdlib -o qwe.elf  obj/main.o obj/test.o
obj/test.o: In function `in_test':
obj/test.o(.text+0x34): undefined reference to \
obj/test.o(.text+0x36): undefined reference to \
obj/test.o(.text+0x64): undefined reference to \
obj/test.o(.text+0xd6): undefined reference to \
obj/test.o(.text+0xee): undefined reference to \
make: *** [qwe.elf] Error 1

It seems, "avr-g++" doesn't behave as i expected it...

And it also seems it expects some functions
from "$(libstdcxx_version)" that are missing now.

Is there somewhere a smaller replacement or
substitution "libstdc++"?

What can i change to make a simple project compile and link?

How do i need to configure and compile gcc to work properly?

Do i make any other error?


#### common.h
#ifndef COMMON_H
#define COMMON_H

#ifdef __cplusplus
# define CBEGIN         extern "C" {
# define CEND           }
# define CBEGIN
# define CEND


#### test.hh
#ifndef TEST_HH
#define TEST_HH

#include "common.h"


extern void in_test(void);



#### main.h
#ifndef MAIN_H
#define MAIN_H

#include "common.h"


extern int var;
extern void in_main(void);



#### main.c
#include "main.h"
#include "test.hh"

int var;

void in_main(void) {
        var += 4;

int main(int argc, char** argv) {
        volatile long long a;
        volatile long b;
        var = 0;


        for(a = 0; a < 1000000; a++) {
                b = a & 0xff;

        return var;

#### test.cc
#include "test.hh"
#include "main.h"

class Abc {
        Abc() {

        ~Abc() {

        void func(void) {
                var += 8;

void in_test(void) {
        Abc a;


        var += 7;

> Hallo,
> Wenn du keinen Mega128 support brauchst, kannst du mein Script
> von http://members.telering.at/jessich/reinhard/avr/index.html
> laden.
> Fertige RPMs kannst du auf
> http://freesoftware.fsf.org/download/simulavr/binaries/  finden.
> Dieser Version hat auch Mega128 support.
> Grüße
>    Reinhard
avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]