Hi, By adding ${UHD_LIBRARIES}, the problem is solved :)
Thanks, Zhihong On Fri, Feb 5, 2016 at 11:40 AM, Zhihong Luo <zh...@umich.edu> wrote: > Hi Marcus, > > Sorry about the pictures, I will use text later on :) > > After adding the gnuradio-runtime, the top-block line works with no > errors. But the gr::uhd::usrp_source::sptr usrp_source = > gr::uhd::usrp_source::make(device_addr, uhd::stream_args_t("fc32")); stills > has error: > > /usr/bin/ld: CMakeFiles/tags.dir/tags.cc.o: undefined reference to symbol > '_ZN3uhd13device_addr_tC1ERKSs' > //usr/local/lib/libuhd.so.003: error adding symbols: DSO missing from > command line > > Thanks, > Zhihong > > > On Fri, Feb 5, 2016 at 4:39 AM, Marcus Müller <marcus.muel...@ettus.com> > wrote: > >> Hi Zhihong, >> >> please stop posting screenshots of text. It's text, you can mark it, copy >> it, and paste it to an email as text. It's way easier for everyone to deal >> with that. >> >> Now, you've used >> >> target_link_libraries(tags gnuradio-uhd boost_system) >> >> >> which links the target "tags" against the libraries "gnuradio-uhd" and >> "boost_system". >> Now, the error you're getting is that the linker can't find things >> related to top_block. >> Point is that top_block belongs to the GNU Radio run-time. Hence, the >> error should be pointing you in the right direction: what you actually need >> to do is >> >> target_link_libraries(tags *gnuradio-runtime* gnuradio-uhd boost_system) >> >> >> Best regards, >> Marcus >> >> On 05.02.2016 06:39, Zhihong Luo wrote: >> >> Hi, >> >> I created an OOT module, added the UHD into the required components and >> added the following lines in the top-level CMakelist.txt and the >> CMakelist.txt under the apps folder. >> >> >> >> The tesr.cc just makes a top_block: gr::top_block_sptr tb = >> gr::make_top_block("tags"), >> which leads to undefined reference. >> >> If I add another line "gr::uhd::usrp_source::sptr usrp_source = >> gr::uhd::usrp_source::make(device_addr, uhd::stream_args_t("fc32")); ", the >> error is: >> >> >> I think it is a linker problem, but I can not find what I am missing. Is >> there anyone who could help me fix this? >> >> Thanks, >> Zhihong >> >> On Thu, Feb 4, 2016 at 9:34 AM, Zhihong Luo <zh...@umich.edu> wrote: >> >>> Hi Tom, >>> >>> Thank you for the advice. The website seems to be really useful. >>> >>> Zhihong >>> >>> >>> 2016年2月4日星期四,Tom Rondeau < <t...@trondeau.com>t...@trondeau.com> 写道: >>> >>>> On Wed, Feb 3, 2016 at 8:28 PM, Zhihong Luo <zh...@umich.edu> wrote: >>>> >>>>> Hi Marcus, >>>>> >>>>> Can you be more specific about what I need to add to the >>>>> CMakeLists.txt? Because in the <modulename>/apps/CMakeLists.tx, there is >>>>> no >>>>> "sources", but only: >>>>> >>>>> include(GrPython) >>>>> >>>>> GR_PYTHON_INSTALL( >>>>> PROGRAMS >>>>> DESTINATION bin >>>>> ) >>>>> >>>>> And in the <modulename>/CMakeLists.txt, what do you mean by "Add "uhd" >>>>> to the list"? Is it "find_package(UHD)"? Or things like including >>>>> ${UHD_INCLUDE_DIRS} ${GR_UHD_INCLUDE_DIRS} >>>>> to the directory? I try to learn from the built-in gr-uhd, but there >>>>> is no apps folder and its CMakeList.txt looks very different. So I was >>>>> lost. >>>>> >>>>> I am really unfamiliar with these, so more detailed explanation will >>>>> be much appreciated. Thanks. >>>>> >>>>> Zhihong Luo >>>>> >>>> >>>> >>>> We appreciate your enthusiasm for use GNU Radio and building stuff with >>>> it. However, the questions you are asking are more related to C++, >>>> makefiles, and CMake. I think you'd be better off studying those and >>>> learning the basics before asking questions like that here. >>>> >>>> Another tactic you can take is to look at all of the projects available >>>> on cgran.org as well as look at the GNU Radio source code itself. We >>>> have lots of examples out there that you can learn from to do what you want >>>> here. >>>> >>>> Tom >>>> >>>> >>>> >>>> >>>>> On Wed, Feb 3, 2016 at 3:56 AM, Zhihong Luo <zh...@umich.edu> wrote: >>>>> >>>>>> Hi Marcus, >>>>>> >>>>>> Thank you for the detailed instructions! I'll test it tomorrow and >>>>>> hopefully it can work :) Have a good night. >>>>>> >>>>>> Zhihong >>>>>> >>>>>> >>>>>> 2016年2月3日星期三,Marcus Müller <marcus.muel...@ettus.com> 写道: >>>>>> >>>>>>> Hi Zhihong Luo, >>>>>>> >>>>>>> you're not linking your program against any GNU Radio component, >>>>>>> which is why the linker step in your compiler call complains about all >>>>>>> the >>>>>>> symbols from these libraries missing. >>>>>>> Normally, it's the job of a build system to set up your compiler >>>>>>> call correctly, but in this case, somethin like >>>>>>> >>>>>>> g++ tags.cpp -o tags $(pkg-config --libs --cflags gnuradio-runtime >>>>>>> gnuradio-uhd) >>>>>>> >>>>>>> should work. >>>>>>> >>>>>>> I'd still recommend not doing that, but using gr_modtool to create a >>>>>>> new out-of-tree module >>>>>>> >>>>>>> gr_modtool newmod >>>>>>> >>>>>>> and add your file in the <modulename>/apps/ folder, adding the >>>>>>> filename to <modulename>/apps/CMakeLists.txt under "sources". Add "uhd" >>>>>>> to >>>>>>> the list of necessary GNU Radio components in >>>>>>> <modulename>/CMakeLists.txt >>>>>>> >>>>>>> Then, it's the normal CMake build procedure: >>>>>>> >>>>>>> cd <modulename> >>>>>>> mkdir build >>>>>>> cd build >>>>>>> cmake .. >>>>>>> make >>>>>>> make install >>>>>>> >>>>>>> On 03.02.2016 09:39, Zhihong Luo wrote: >>>>>>> >>>>>>> Hi Marcus, >>>>>>> >>>>>>> Sorry, I was typing and accidentally sent it out the previous one... >>>>>>> The code is >>>>>>> >>>>>>> #include<gnuradio/top_block.h> >>>>>>> #include<gnuradio/uhd/usrp_source.h> >>>>>>> #include<uhd/utils/safe_main.hpp> >>>>>>> #include <boost/make_shared.hpp> >>>>>>> #include <boost/thread/thread.hpp> >>>>>>> #include <boost/program_options.hpp> >>>>>>> #include <csignal> >>>>>>> #include <iostream> >>>>>>> >>>>>>> namespace po = boost::program_options; >>>>>>> int UHD_SAFE_MAIN(int argc, char *argv[]){ std::string device_addr >>>>>>> =" "; >>>>>>> >>>>>>> gr::top_block_sptr tb = gr::make_top_block("tags_demo"); >>>>>>> >>>>>>> gr::uhd::usrp_source::sptr usrp_source = >>>>>>> gr::uhd::usrp_source::make(device_addr, >>>>>>> uhd::stream_args_t("fc32")); } >>>>>>> >>>>>>> Then I ran the command: >>>>>>> g++ tags.cpp -o tags -l boost_system >>>>>>> >>>>>>> which ends up having errors: >>>>>>> >>>>>>> undefined reference to gr::make_top_block, uhd::device_addr_t, >>>>>>> gr::uhd::usrp_source and etc. >>>>>>> >>>>>>> Thanks, >>>>>>> Zhihong Luo >>>>>>> >>>>>>> On Wed, Feb 3, 2016 at 4:29 PM, Zhihong Luo <zh...@umich.edu> wrote: >>>>>>> >>>>>>>> Hi Marcus, >>>>>>>> >>>>>>>> Of course. Here are the codes: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Feb 3, 2016 at 4:13 PM, Marcus Müller < >>>>>>>> marcus.muel...@ettus.com> wrote: >>>>>>>> >>>>>>>>> Hi Zhihong Luo, >>>>>>>>> >>>>>>>>> could you please rather share text than pictures of text, too >>>>>>>>> small for reading? >>>>>>>>> >>>>>>>>> Best regards, >>>>>>>>> Marcus >>>>>>>>> >>>>>>>>> >>>>>>>>> On 03.02.2016 07:31, Zhihong Luo wrote: >>>>>>>>> >>>>>>>>> Hi all, >>>>>>>>> >>>>>>>>> I just started to learn to use c++ for gnuradio, and I copied some >>>>>>>>> codes from the "tags_demo.cc". But compilation error occurred as >>>>>>>>> shown in >>>>>>>>> the following screen shots. Can you tell me where I made a mistake? >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Zhihong Luo >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Discuss-gnuradio mailing >>>>>>>>> listDiscuss-gnuradio@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnuradio >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Discuss-gnuradio mailing list >>>>>>>>> Discuss-gnuradio@gnu.org >>>>>>>>> <https://lists.gnu.org/mailman/listinfo/discuss-gnuradio> >>>>>>>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>> >>>>> _______________________________________________ >>>>> Discuss-gnuradio mailing list >>>>> Discuss-gnuradio@gnu.org >>>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio >>>>> >>>>> >>>> >> >> >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio