Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

How to compile a uClinux C++ file in Nios IDE?

I'm having troubles compiling a very simple C++ program for uClinux in Nios IDE. It is a problem with multiple definitions of _start (by crt0, libc.a, etc). I saw other topics reporting that too, but I got no success solving that.

Can anyone post a step-by-step (or any help) to set up the environment for C++ uClinux project in nios IDE?

Someone has a makefile (and rules.mak) to build similar projects? (and a makefile for linux OS).

Thnks a lot in advance!

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi francisinhori

    Actualy,it don't support c++.but you can test simple c++ prog.

    Here you have to change the rule.mk (CC := $(CROSS)g++)

    and you have to add some line in simple make file given for helo example.

    Sure, it will run.

    -slsnios
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by slsnios@Sep 19 2006, 10:10 AM

    hi francisinhori

    actualy,it don't support c++.but you can test simple c++ prog.

    here you have to change the rule.mk (cc := $(cross)g++)

    and you have to add some line in simple make file given for helo example.

    sure, it will run.

    -slsnios

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=18346)

    --- quote end ---

    --- Quote End ---

    I&#39;ve already tried this (CC:= $(CROSS)g++), but it didn&#39;t work. Has someone tried to compile with nios2-uClinux-g++ in linux OS? I got the binary nios 2 toolchain from nios wiki, but it says that c++ compiler is not installed, and the CrossGcc tutorial is only for newlib (instead of uclinux lib).
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by francosinhori+sep 21 2006, 07:13 pm--><div class='quotetop'>quote (francosinhori @ sep 21 2006, 07:13 pm)</div>

    --- quote start ---

    <!--quotebegin-slsnios@Sep 19 2006, 10:10 AM

    hi francisinhori

    actualy,it don&#39;t support c++.but you can test simple c++ prog.

    here you have to change the rule.mk (cc := $(cross)g++)

    and you have to add some line in simple make file given for helo example.

    sure, it will run.

    -slsnios

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=18346)

    --- quote end ---

    --- Quote End ---

    I&#39;ve already tried this (CC:= $(CROSS)g++), but it didn&#39;t work. Has someone tried to compile with nios2-uClinux-g++ in linux OS? I got the binary nios 2 toolchain from nios wiki, but it says that c++ compiler is not installed, and the CrossGcc tutorial is only for newlib (instead of uclinux lib).

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=18387)</div>

    [/b]

    --- Quote End ---

    hi

    u have to change Rules.mak

    1->

    CC := $(CROSS)g++

    2->

    %.o : %.cpp Makefile

    $(CC) $(CFLAGS) $(WARNING_FLAGS) -c -o $@ $<

    write above two line in place of folowing lines:

    %.o : %.c Makefile

    $(CC) $(CFLAGS) $(WARNING_FLAGS) -c -o $@ $<

    %.o : %.cpp Makefile

    $(CC) $(CFLAGS) $(WARNING_FLAGS) -o $@ $<