discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] gr-modtool cpp generation issue


From: Al Anderson
Subject: [Discuss-gnuradio] gr-modtool cpp generation issue
Date: Tue, 19 May 2015 19:03:54 -0600

I am in the process of converting some 3.6 modules to 3.7. So I am generating new modules then adding the code from the old modules. I have one module that takes a filename as a parameter so it is declared like this in this test module:  

testfilename_impl::testfilename_impl(unsigned short printing, unsigned short print_type, const char *filename). 

When I compile I get the error: 

/home/sysala/BisonSAT/gr-bs/lib/testfilename_impl.cc:35:63: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
         (new testfilename_impl(printing, print_type, *filename));

The fix I found is to get rid of the * in front of the filename in the above line. Here is the incorrect declaration: 

    testfilename::make(unsigned short printing, unsigned short print_type, const char *filename)
    {
      return gnuradio::get_initial_sptr
        (new testfilename_impl(printing, print_type, *filename));
    }


Here is the corrected one:

    testfilename::make(unsigned short printing, unsigned short print_type, const char *filename)
    {
      return gnuradio::get_initial_sptr
        (new testfilename_impl(printing, print_type, filename)); //got rid of * here
    }

I can repeat this by just generating a simple general module with this const char *filename parameter. The above declaration is generated by gr_modtool. So if I move the * to next to the char when I enter parameters in gr_modtool add it works fine. So I am not sure if this is poor C++ or the gr_modtool just slurping up the *filename but I will point out the file_sink block bundled with gnuradio declares its filename with the * next to the parameter name: file_sink::make(size_t itemsize, const char *filename, bool append).

I am using gnuradio verison 3.7.2.1.


Al
--


====================
Al Anderson, N0XV
Director, IT Services
Salish Kootenai College
(p) 406.275.4833
(c) 406.214.8292
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]