于 2013/5/15 0:50, Tom Rondeau 写道:
On Tue, May 14, 2013 at 2:08 PM, Gong Zhang <address@hidden> wrote:
Hi,
I wanna execute the dial_tone.cc example.So I execute "g++ dial_tone.cc
-I /usr/local/include/gnuradio/"
But I got the errors:
laptop:~/Desktop/ccompile$ g++ dial_tone.cc -I /usr/local/include/gnuradio/
/tmp/ccxAFik0.o: In function `main':
dial_tone.cc:(.text+0x59): undefined reference to
`gr_make_top_block(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
dial_tone.cc:(.text+0xc2): undefined reference to
`gr_make_sig_source_f(double, gr_waveform_t, double, double, float)'
dial_tone.cc:(.text+0xfb): undefined reference to
`gr_make_sig_source_f(double, gr_waveform_t, double, double, float)'
dial_tone.cc:(.text+0x176): undefined reference to `audio_make_sink(int,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
bool)'
dial_tone.cc:(.text+0x238): undefined reference to
`gr_hier_block2::connect(boost::shared_ptr<gr_basic_block>, int,
boost::shared_ptr<gr_basic_block>, int)'
dial_tone.cc:(.text+0x2de): undefined reference to
`gr_hier_block2::connect(boost::shared_ptr<gr_basic_block>, int,
boost::shared_ptr<gr_basic_block>, int)'
dial_tone.cc:(.text+0x33d): undefined reference to `gr_top_block::run(int)'
collect2: ld returned 1 exit status
You should able to just build it running 'make' in the build
directory, not have to use your own g++ command line. Cmake should set
up the Makefile for the correct includes, linkings, flags, etc. It
should just be built when you built the rest of GNU Radio, anyways.
Tom
Does it mean I should add CMakeList for my .cc example? Can I compile the example through g++ command line?
You might need to clarify what you mean by "execute the dial_tone.cc example". As Tom pointed out it gets built and installed along with the rest of GNU Radio. it should be in $INSTALLPREFIX/gnuradio/examples/gnuradio/audio/dial_tone where $INSTALLPREFIX is often /usr/local/share
If you're trying to do something else then you'll need to rephrase the question.