解決したいこと
gnuradio の自作ブロックを作っているのですが、コンパイル時に'dose not name a type'というエラーが出てしまいます。
調べて色々試したのですが、解決しません。何が原因なのでしょうか。
発生している問題・エラーメッセージ
error: ‘Ki’ does not name a type 118 | Ki[i][1] = (Myu4i[i][1] - 4 * Myu3i[i][1] * Myu1i[i][1] + 6 * Myu2i[i][1] * Myu1i[i][1] * Myu1i[i][1] | ^~
該当のソースコード
Kurtosis_c1_impl.h
#ifndef INCLUDED_KURTOSIS1_KURTOSIS_C1_IMPL_H #define INCLUDED_KURTOSIS1_KURTOSIS_C1_IMPL_H #include <Kurtosis1/Kurtosis_c1.h> #include <fftw3.h> namespace gr { namespace Kurtosis1 { class Kurtosis_c1_impl : public Kurtosis_c1 { private: int d_N; fftw_complex* Kr; fftw_complex* Ki; fftw_complex* S1r; fftw_complex* S1i; fftw_complex* S2r; fftw_complex* S2i; fftw_complex* S3r; fftw_complex* S3i; fftw_complex* S4r; fftw_complex* S4i; fftw_complex* Myu1r; fftw_complex* Myu1i; fftw_complex* Myu2r; fftw_complex* Myu2i; fftw_complex* Myu3r; fftw_complex* Myu3i; fftw_complex* Myu4r; fftw_complex* Myu4i; fftw_complex* dcnt; fftw_complex* d_inputr; fftw_complex* d_inputi; fftw_plan d_plan; public: Kurtosis_c1_impl(int fftsize); ~Kurtosis_c1_impl(); // Where all the action really happens int work( int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items ); }; } // namespace Kurtosis1 } // namespace gr #endif /* INCLUDED_KURTOSIS1_KURTOSIS_C1_IMPL_H */
Kurtosis_c1_impl.cc
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <gnuradio/io_signature.h> #include "Kurtosis_c1_impl.h" namespace gr { namespace Kurtosis1 { Kurtosis_c1::sptr Kurtosis_c1::make(int fftsize) { return gnuradio::get_initial_sptr (new Kurtosis_c1_impl(fftsize)); } /* * The private constructor */ Kurtosis_c1_impl::Kurtosis_c1_impl(int fftsize) : gr::sync_block("Kurtosis_c1", gr::io_signature::make(1, 1, sizeof(gr_complex)), gr::io_signature::make(0, 0, 0)), d_N(fftsize) { d_inputr = d_inputi = (fftw_complex*)fftw_malloc(sizeof(gr_complex) * d_N); Kr = Ki = (fftw_complex*)fftw_malloc(sizeof(gr_complex) * d_N); d_plan = fftw_plan_dft_1d(d_N, d_inputr, d_inputi, FFTW_BACKWARD, FFTW_ESTIMATE); } /* * Our virtual destructor. */ Kurtosis_c1_impl::~Kurtosis_c1_impl() { } int Kurtosis_c1_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { const gr_complex *in = (const gr_complex*) input_items[0]; for(int i = 0; i < noutput_items; i++) { d_inputr[i][0] = in[i].real(); d_inputi[i][1] = in[i].imag(); } fftw_execute(d_plan); for(int i = 0; i < noutput_items ;i++) { S1r[i][0] = S1r[i][0] + d_inputr[i][0]; S1i[i][1] = S1i[i][1] + d_inputi[i][1]; S2r[i][0] = S2r[i][0] + d_inputr[i][0] * d_inputr[i][0]; S2i[i][1] = S2i[i][1] + d_inputi[i][1] * d_inputi[i][1]; S3r[i][0] = S3r[i][0] + d_inputr[i][0] * d_inputr[i][0] * d_inputr[i][0]; S3i[i][1] = S3i[i][1] + d_inputi[i][1] * d_inputi[i][1] * d_inputi[i][1]; S4r[i][0] = S4r[i][0] + d_inputr[i][0] * d_inputr[i][0] * d_inputr[i][0] * d_inputr[i][0]; S4i[i][1] = S4i[i][1] + d_inputi[i][1] * d_inputi[i][1] * d_inputi[i][1] * d_inputi[i][1]; dcnt[i][0] = dcnt[i][0] + 1; dcnt[i][1] = dcnt[i][1] + 1; } for(int i = 0; i < noutput_items; i++) { Myu1r[i][0] = S1r[i][0] / dcnt[i][0]; Myu1i[i][1] = S1i[i][1] / dcnt[i][1]; Myu2r[i][0] = S2r[i][0] / dcnt[i][0]; Myu2i[i][1] = S2i[i][1] / dcnt[i][1]; Myu3r[i][0] = S3r[i][0] / dcnt[i][0]; Myu3i[i][1] = S3i[i][1] / dcnt[i][1]; Myu4r[i][0] = S4r[i][0] / dcnt[i][0]; Myu4i[i][1] = S4i[i][1] / dcnt[i][1]; } /* output average in dB */ for(int i = 0; i < noutput_items; i++) } Kr[i][0] = (Myu4r[i][0] - 4 * Myu3r[i][0] * Myu1r[i][0] + 6 * Myu2r[i][0] * Myu1r[i][0] * Myu1r[i][0] - 3 * Myu1r[i][0] * Myu1r[i][0] * Myu1r[i][0] * Myu1r[i][0]) / ((Myu2r[i][0] - Myu1r[i][0] * Myu1r[i][0]) * (Myu2r[i][0] - Myu1r[i][0] * Myu1r[i][0])); Ki[i][1] = (Myu4i[i][1] - 4 * Myu3i[i][1] * Myu1i[i][1] + 6 * Myu2i[i][1] * Myu1i[i][1] * Myu1i[i][1] - 3 * Myu1i[i][1] * Myu1i[i][1] * Myu1i[i][1] * Myu1i[i][1]) / ((Myu2i[i][1] - Myu1i[i][1] * Myu1i[i][1]) * (Myu2i[i][1] - Myu1i[i][1] * Myu1i[i][1])); } // Tell runtime system how many output items we produced. return noutput_items; } } /* namespace Kurtosis1 */ } /* namespace gr */
まだ回答がついていません
会員登録して回答してみよう