C++ compiling problem

W

wentaozhou

Hi all,

I encounter a problem when compiling in Ubuntu a c++ code wrote
originally also in linux environment. It seems to be the problem of
standard template library but I totally don't know how to handle it.
Could anybody help me out?
Below please see the error message:

.......
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ca):
undefined reference to `std::__default_alloc_template<true,
0>::_S_free_list'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5d8):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ea):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
.../../lembsk/liblembsk.a(block.o): In function `void
std::_Construct<std::vector<double, std::allocator<double> >,
std::vector<double, std::allocator<double> > >(std::vector<double,
std::allocator<double> >*, std::vector<double, std::allocator<double> >
const&)':
block.cpp:(.gnu.linkonce.t._ZSt10_ConstructISt6vectorIdSaIdEES2_EvPT_RKT0_+0x40):
undefined reference to `std::__default_alloc_template<true,
0>::allocate(unsigned int)'
collect2: ld returned 1 exit status
make[2]: *** [lembsk] Error 1
make[2]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized'
make: *** [all] Error 2


Thanks so much!

Vito
 
O

Ondra Holub

(e-mail address removed) napsal:
Hi all,

I encounter a problem when compiling in Ubuntu a c++ code wrote
originally also in linux environment. It seems to be the problem of
standard template library but I totally don't know how to handle it.
Could anybody help me out?
Below please see the error message:

......
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ca):
undefined reference to `std::__default_alloc_template<true,
0>::_S_free_list'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5d8):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ea):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
../../lembsk/liblembsk.a(block.o): In function `void
std::_Construct<std::vector<double, std::allocator<double> >,
std::vector<double, std::allocator<double> > >(std::vector<double,
std::allocator<double> >*, std::vector<double, std::allocator<double> >
const&)':
block.cpp:(.gnu.linkonce.t._ZSt10_ConstructISt6vectorIdSaIdEES2_EvPT_RKT0_+0x40):
undefined reference to `std::__default_alloc_template<true,
0>::allocate(unsigned int)'
collect2: ld returned 1 exit status
make[2]: *** [lembsk] Error 1
make[2]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized'
make: *** [all] Error 2


Thanks so much!

Vito

Hi. Are you linking with g++ or with gcc? C++ code should be compiled
and linked with g++, because it automaticaly adds to linker standard
C++ library (in default behaviour).
 
J

Jacek Dziedzic

Hi all,

I encounter a problem when compiling in Ubuntu a c++ code wrote
originally also in linux environment. It seems to be the problem of
standard template library but I totally don't know how to handle it.
Could anybody help me out?
Below please see the error message:

......
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ca):
undefined reference to `std::__default_alloc_template<true,
0>::_S_free_list'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5d8):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ea):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
../../lembsk/liblembsk.a(block.o): In function `void
std::_Construct<std::vector<double, std::allocator<double> >,
std::vector<double, std::allocator<double> > >(std::vector<double,
std::allocator<double> >*, std::vector<double, std::allocator<double> >
const&)':
block.cpp:(.gnu.linkonce.t._ZSt10_ConstructISt6vectorIdSaIdEES2_EvPT_RKT0_+0x40):
undefined reference to `std::__default_alloc_template<true,
0>::allocate(unsigned int)'
collect2: ld returned 1 exit status
make[2]: *** [lembsk] Error 1
make[2]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized'
make: *** [all] Error 2


Thanks so much!

What does "g++ --version" say?

- J.
 
V

vito

I linked with g++.
Ondra said:
(e-mail address removed) napsal:
Hi all,

I encounter a problem when compiling in Ubuntu a c++ code wrote
originally also in linux environment. It seems to be the problem of
standard template library but I totally don't know how to handle it.
Could anybody help me out?
Below please see the error message:

......
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ca):
undefined reference to `std::__default_alloc_template<true,
0>::_S_free_list'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5d8):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
block.cpp:(.gnu.linkonce.t._ZN6lembsk5FieldISt6vectorINS_5PointESaIS2_EEE7setsizeEiiii+0x5ea):
undefined reference to `std::__default_alloc_template<true,
0>::_S_node_allocator_lock'
../../lembsk/liblembsk.a(block.o): In function `void
std::_Construct<std::vector<double, std::allocator<double> >,
std::vector<double, std::allocator<double> > >(std::vector<double,
std::allocator<double> >*, std::vector<double, std::allocator<double> >
const&)':
block.cpp:(.gnu.linkonce.t._ZSt10_ConstructISt6vectorIdSaIdEES2_EvPT_RKT0_+0x40):
undefined reference to `std::__default_alloc_template<true,
0>::allocate(unsigned int)'
collect2: ld returned 1 exit status
make[2]: *** [lembsk] Error 1
make[2]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/vito/_research_stanford/code/lembsk/Optimized'
make: *** [all] Error 2


Thanks so much!

Vito

Hi. Are you linking with g++ or with gcc? C++ code should be compiled
and linked with g++, because it automaticaly adds to linker standard
C++ library (in default behaviour).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top