Can't compile C++ example

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 togr_make_top_block(std::basic_string<char, std::char_traits,
std::allocator > 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 togr_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 togr_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 togr_top_block::run(int)’
collect2: ld returned 1 exit status

On Tue, May 14, 2013 at 2:08 PM, Gong Z. [email protected] wrote:

gr_make_sig_source_f(double, gr_waveform_t, double, double, float)' 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

于 2013/5/15 0:50, Tom R. 写道:

dial_tone.cc:(.text+0xc2): 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 togr_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?

On Tue, May 14, 2013 at 9:53 PM, Gong Z. [email protected] wrote:

/usr/local/include/gnuradio/
bool)’
You should able to just build it running ‘make’ in the build

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.