> From: Jonas Hodel [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 29, 2006 1:05 PM > To: Eric Blossom > Cc: discuss-gnuradio@gnu.org > Subject: Re: [Discuss-gnuradio] Multiple C files required by single C++ > block.How to build? > > > Hello, > > Thanks to both Eric and Daniel for your prompt help. > > Yes this does make sense and it was the first thing I tried. After it didn't > work with my files I went right back to basics (I am building a la > gr-howto-write-a-block). I created very simple .h/.c files as a test. > > Then: > Within "howto_square2_ff.h" I added #include "test.h". > Within "howto_square2_ff.cc" I added a call to jonas_test(), located in the > constructor howto_square2_ff (). > I added test.c to the "_howto_la_SOURCES" entry in "src/lib/Makefile.am". > > Finally: "make clean", "make" and "make check". > > This results in: > > ImportError: > /home/jonas/gnuradio/gr-howto-write-a-block-3.0.2/src/lib/.libs/_howto.so: > undefined symbol: _Z10jonas_testv
This is because you included a C .h file into a C++ source file. The compiler assumed (since you didn't tell it otherwise) that jonas_test was a C++ function. Thus the name mangling. The fix is to surround the inclusion of the C include file with: extern "C" { #include "jonas_test.h" } FWIW, this is standard C++, and has nothing to do with GNU Radio, SWIG or Python. Eric _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio