Problem trying to implement Reed Solomon encoder

Hello,

I’m trying to create a GNU Radio block that carries out a Reed Solomon
coding based on the functions provided into the
directory /gnuradio-core/src/lib/reed-solomon.

As an example I have taken the block gr_encode_ccsds_27 that can be
found in the directory /gnuradio-core/src/lib/general since it uses the
functions implemented in /gnuradio-core/src/lib/viterbi.

Basically the aspect of my gr_rs_encoder_vbb.cc file is the following:

#ifdef HAVE_CONFIG_H
#include “config.h”
#endif

#include <gr_rs_encoder_vbb.h>
#include <gr_io_signature.h>

extern “C” {
#include “…/reed-solomon/fixed.h”
}

gr_rs_encoder_vbb_sptr
gr_make_rs_encoder_vbb()
{
return gr_rs_encoder_vbb_sptr(new gr_rs_encoder_vbb());
}

gr_rs_encoder_vbb::gr_rs_encoder_vbb()
: gr_sync_block(“rs_encoder_vbb”,
gr_make_io_signature(1, 1, (223)sizeof(char)),
gr_make_io_signature(1, 1, 255
sizeof(char)))
{
}

gr_rs_encoder_vbb::~gr_rs_encoder_vbb()
{
}

int
gr_rs_encoder_vbb::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const unsigned char *in = (const unsigned char *)input_items[0];
unsigned char *out = (unsigned char *)output_items[0];

for (int i = 0; i < noutput_items; i++)
{
unsigned char *temp_first_element = out;
for (int j = 0; j < (223); j++)
*out++ = *in++;
ENCODE_RS(temp_first_element,–out);
}

return noutput_items;
}

I include the file fixed.h since I want to use the implementation of the
CCSDS standard (255,223).

When I execute make into the main folder of GNU Radio for compiling
everything I get the following ERROR message:

/bin/bash …/…/…/libtool --tag=CXX --mode=link g++ -g -O2 -Wall
-Woverloaded-virtual -pthread -o benchmark_dotprod_fff
benchmark_dotprod_fff.o
/home/apalomo/software/gnuradio-3.1.3/gnuradio-core/src/lib/libgnuradio-core.la
libtool: link: g++ -g -O2 -Wall -Woverloaded-virtual -pthread
-o .libs/benchmark_dotprod_fff
benchmark_dotprod_fff.o
/home/apalomo/software/gnuradio-3.1.3/gnuradio-core/src/lib/.libs/libgnuradio-core.so
/home/apalomo/software/gnuradio-3.1.3/omnithread/.libs/libgromnithread.so
-lrt /usr/lib/libfftw3f.so -lm -pthread
/home/apalomo/software/gnuradio-3.1.3/gnuradio-core/src/lib/.libs/libgnuradio-core.so:
undefined reference to encode_rs_8' collect2: ld returned 1 exit status make[4]: *** [benchmark_dotprod_fff] Error 1 make[4]: Leaving directory/home/apalomo/software/gnuradio-3.1.3/gnuradio-core/src/tests’
make[3]: *** [all-recursive] Error 1

It looks like I’m missing to include another file somewhere, but I have
no idea where.

Have anybody tried to implement this yet or anybody knows how I could
fix it?

Thank you very much.

Best regards.

Alvaro P.

Hi,

Your problem is because you are not linking with the Reed/Solomon
library.

The problem is that you’ve wrapped the ‘#include <fixed.h>’ inside an
‘extern “C”’ block.

If you remove it then you’ll be one step closer to getting it working.

Is mise,

Stevie

Hi Stevie,

thank you very much for the advice. I have tried to compile it removing
the extern C wrap but it is not working, it keep on displaying the same
error message.

Maybe I’m wrong, but since all the files in the directory
lib/reed-solomon are written in C instead of C++, isn’t the wrap “extern
C” necessary in my C++ component code?

Thanks again.

Alvaro