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

Re: [microblaze-uclinux] C++



Hi Larry,
I checked the location of the vector header file and it appears to be located at: PetaLinux\tools\linux-i386\microblaze-uclinux-tools\include\c++\3.4.1

Have you tried removing this directive from your make file?
#apparent location of stl? CXXFLAGS += -I$(ROOTDIR)/lib/STLport/stlport

Try using the petalinux new app command "petalinux-new-app myappname" in the user-apps command to generate a header file for you. If you don't have this or you are not using petalinux, here is a make file that you can verify against.

Hope to hear of success.

#########################################################################################

# Point to default PetaLinux root directory
ifndef ROOTDIR
ROOTDIR=../../petalinux-dist
endif

UCLINUX_BUILD_USER = 1
-include $(ROOTDIR)/.config
-include $(ROOTDIR)/$(CONFIG_LINUXDIR)/.config
LIBCDIR = $(CONFIG_LIBCDIR)
-include $(ROOTDIR)/config.arch
ROMFSDIR=$(ROOTDIR)/romfs
ROMFSINST=$(ROOTDIR)/tools/romfs- inst.sh

PATH  += $(ROOTDIR)/tools
CC=microblaze-uclinux-c++

APP = TestMotor

# Add any other object files to this list below
APP_OBJS = TestMotor.o TCPHandler.o TIMERHandler.o

all: $(APP)

$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

clean:
    -rm -f $(APP) *.elf *.gdb *.o

romfs:
    $(ROMFSINST) $(APP) /bin/$(APP)

%.o: %.cpp
    $(CC) -c $(CFLAGS) -o $@ $<


# Targets for the required .config files - if they don't exist, the tree isn't
# configured.  Tell the user this, how to fix it, and exit.
${ROOTDIR}/config.arch ${ROOTDIR}/.config:
    @echo "Error: You must configure the PetaLinux tree before compiling your application"
    @echo ""
    @echo "Change directory to ../../petalinux-dist and 'make menuconfig' or 'make xconfig'"
    @echo ""
    @echo "Once the tree is configured, return to this directory, and re-run make."
    @echo ""
    @exit -1

#################################################################################

On 3/16/07, Larry Rystrom <Rystrom@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi All,

I am new to uclinux, so please bear with me if I should already know the
answer. Our company would like to take an existing c++ software
application and make it run under uclinux. I find I am unable to get
even a "hello world" application (below) to compile under uclinux,
apparently due to missing standard template library headers. Does anyone
have any suggestions on how to build a c++ application?

Thanks in advance.

Larry


////////////////////////////////////////////////////////////////////////
/
// main.cpp
#include <vector>
#include <algorithm>
#include <iostream>

int main()
{
  std::vector<int> vTest;

  vTest.push_back( 3 );
  vTest.push_back( 2 );
  vTest.push_back( 1 );
  std::sort( vTest.begin(),vTest.end() );
  int nI;
  for(nI=0; nI < vTest.size(); nI++)
    std::cout << nI << ":" << vTest[nI] << std::endl;


  std::cout << "Hello to the uClinux World" << std::endl;
  return 0;
}

########################################################################
#######
#Makefile adapted from avnet tutorial dvd:

ROOTDIR=/home/avnet/uClinux-cvs/uClinux-dist
ROOT_INC_DIR = $(ROOTDIR)/linux- 2.4.x
UCLINUX_BUILD_USER = 1
include $(ROOTDIR)/.config
LIBCDIR = $(CONFIG_LIBCDIR)
include $(ROOTDIR)/config.arch
ROMFSDIR=$(ROOTDIR)/romfs
ROMFSINST=$(ROOTDIR)/tools/romfs-inst.sh
PATH:=$(PATH):$(ROOTDIR)/tools
CFLAGS += -O0
#apparent location of stl?
CXXFLAGS += -I$(ROOTDIR)/lib/STLport/stlport

APP = hello
#APP = $(FILE)

APP_OBJS = main.o
#APP_OBJS = $(APP).o


all: $(APP)

$(APP): $(APP_OBJS)
        $(CC) -o $@ $(APP_OBJS) $(LDLIBS) -Wl,-elf2flt

clean:
        -rm -f $(APP) *.elf *.gdb *.o

romfs:
        $(ROMFSINST) $(APP) /bin/$(APP)

%.o: %.c
        $(CC) -c $(CFLAGS) -o $@ $< -Iinclude

%.o: %.cpp
        $(CXX) -c $(CXXFLAGS) -o $@ $< -Iinclude



Compilation results:
[avnet@localhost HelloCpp1]make main.o
ucfront-g++ mb-g++  -c -Os -g -fomit-frame-pointer -pipe -fno-common
-fno-builtin -Wall   -msoft-float -mxl-soft-mul -mxl-soft-div  -DEMBED
-Dlinux -D__linux__ -Dunix -D__uClinux__ -O0 -nostdinc++ -fno-exceptions
-I/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport -o main.o
main.cpp -Iinclude
In file included from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_algobase.h
:47,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/vector:36,
                 from main.cpp:1:
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib:90:
error: `::llabs' has not been declared
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib:91:
error: `::lldiv_t' has not been declared
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib:92:
error: `::lldiv' has not been declared
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib: In
function `long long int abs(long long int)':
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib:131:
error: `::llabs' has not been declared
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib: At
global scope:
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/cstdlib:132:
error: `lldiv_t' does not name a type
In file included from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_alloc.h:62
,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_vector.h:3
8,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/vector:40,
                 from main.cpp:1:
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/new:48:48:
../3.4.1/new: No such file or directory
In file included from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stdexcept:37,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_ios_base.h
:22,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_ios.h:23,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_istream.h:
27,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/iostream:39,
                 from main.cpp:3:
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/exception:62:58
: ../3.4.1/exception: No such file or directory
In file included from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_ios_base.h
:22,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_ios.h:23,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_istream.h:
27,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/iostream:39,
                 from main.cpp:3:
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stdexcept:81:
error: expected class-name before '{' token
In file included from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_istream.h:
31,
                 from
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/iostream:39,
                 from main.cpp:3:
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_ostream.h:
In destructor `std::basic_ostream<_CharT, _Traits>::sentry::~sentry()':
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_ostream.h:
173: error: `uncaught_exception' is not a member of `__std_alias'
main.cpp: In function `int main()':
main.cpp:14: warning: comparison between signed and unsigned integer
expressions
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_construct.
h: In function `void std::_Copy_Construct(_Tp*, const _Tp&) [with _Tp =
int]':
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_vector.h:3
51:   instantiated from `void std::vector<_Tp, _Alloc>::push_back(const
_Tp&) [with _Tp = int, _Alloc = std::allocator<int>]'
main.cpp:9:   instantiated from here
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_construct.
h:115: error: no matching function for call to `operator new(long
unsigned int, int*&)'
<internal>:0: note: candidates are: void* operator new(long unsigned
int)
/home/avnet/uClinux-cvs/uClinux-dist/lib/STLport/stlport/stl/_alloc.h:26
7: confused by earlier errors, bailing out
make: *** [main.o] Error 1

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jose A. Torres
Multi Disciplinary Robotics Club
Multi Agent Bio-Robotics Lab (09-1100)
Kate Gleason College of Engineering
Rochester Institute of Technology

http://mdrc.rit.edu
http://gameboysandrobots.com

Email: jat5737@xxxxxxx
Lab phone:(585) 475-7208
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~