gcc 2.96 ld failed for bitset count()

A

Allen

I use std::bitset in a VxWorks project. The following is demo codes.

#include <bitset>

int main()
{
std::bitset<256> bs;
bs.count();
}
g++ -o test test.cpp

When linking, g++ tells error.

partialImage.o: In function `_Base_bitset<2, unsigned
long>::_M_do_count(void) const':
partialImage.o(.text+0x3e8fa): undefined reference to
`_Bit_count<true>::_S_bit_count'
partialImage.o(.text+0x3e90a): undefined reference to
`_Bit_count<true>::_S_bit_count'

VxWorks gcc version is 2.96. How to correct this error?
Thank you.

Allen
 
I

Ian Collins

Allen said:
I use std::bitset in a VxWorks project. The following is demo codes.

#include <bitset>

int main()
{
std::bitset<256> bs;
bs.count();
}


When linking, g++ tells error.

partialImage.o: In function `_Base_bitset<2, unsigned
long>::_M_do_count(void) const':
partialImage.o(.text+0x3e8fa): undefined reference to
`_Bit_count<true>::_S_bit_count'
partialImage.o(.text+0x3e90a): undefined reference to
`_Bit_count<true>::_S_bit_count'

VxWorks gcc version is 2.96. How to correct this error?
Thank you.
Looks like a tool chain bug, check with your vendor.
 
R

red floyd

Juha said:
Maybe try with a version of gcc which isn't like 10 years old?

He can't. That's the version bundled with VxWorks 5.5. It's been
specifically tweaked to generate VxWorks compatible code. Yeah, he
*could*, in theory, get the source to VxWorks' gcc, and update a 3.x
or later gcc, but that's not his job. His job is to develop some sort
of embedded system.
 

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,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top