Although this question has been asked previously on the community, however, those other cases are different from mine, and their solutions cannot be applied in my case.
So I have a very big header "rrc_nbiot.h" file with the following struct:
#include "rrc.h"
namespace asn1 {
namespace rrc {
...
// SystemInformationBlockType2-NB-r13 ::= SEQUENCE
struct sib_type2_nb_r13_s {
struct freq_info_r13_s_ {
bool ul_carrier_freq_r13_present = false;
carrier_freq_nb_r13_s ul_carrier_freq_r13;
uint8_t add_spec_emission_r13 = 1;
};
using multi_band_info_list_r13_l_ = bounded_array<uint8_t, 8>;
struct freq_info_v1530_s_ {
tdd_ul_dl_align_offset_nb_r15_e tdd_ul_dl_align_offset_r15;
};
// member variables
bool ext = false;
bool multi_band_info_list_r13_present = false;
bool late_non_crit_ext_present = false;
rr_cfg_common_sib_nb_r13_s rr_cfg_common_r13;
ue_timers_and_consts_nb_r13_s ue_timers_and_consts_r13;
freq_info_r13_s_ freq_info_r13;
time_align_timer_e time_align_timer_common_r13;
multi_band_info_list_r13_l_ multi_band_info_list_r13;
dyn_octstring late_non_crit_ext;
// ...
// group 0
bool cp_reest_r14_present = false;
// group 1
bool serving_cell_meas_info_r14_present = false;
bool cqi_report_r14_present = false;
// group 2
bool enhanced_phr_r15_present = false;
bool cp_edt_r15_present = false;
bool up_edt_r15_present = false;
copy_ptr<freq_info_v1530_s_> freq_info_v1530;
// sequence methods
SRSASN_CODE pack(bit_ref& bref) const;
SRSASN_CODE unpack(cbit_ref& bref);
void to_json(json_writer& j) const;
};
...
} // namespace rrc
} // namespace asn1
The member function "pack" that is declared in the struct above is defined in another file. "rrc_nbiot.cc"
// SystemInformationBlockType2-NB-r13 ::= SEQUENCE
SRSASN_CODE sib_type2_nb_r13_s::pack(bit_ref& bref) const
{
/* some code */
return SRSASN_SUCCESS;
}
In my main file "main.cpp" I instantiate the struct and try to call the member function as such:
#include "srsran/asn1/rrc_nbiot.h"
struct asn1::rrc::sib_type2_nb_r13_s sib2;
struct asn1::rrc::sib_type2_nb_r13_s *sib2_ref = &sib2;
int main(int argc, char** argv)
{
uint8_t buf[1024];
uint32_t nof_bytes = 2;
asn1::bit_ref bref;
sib2_ref->pack(&bref);
...
When I compile, I get the error:
" error: no matching function for call to ‘asn1::rrc::sib_type2_nb_r13_s::pack(asn1::bit_ref*)’
sib2_ref->pack(&bref); "
Although as you see in the header file "pack" is clearly declared under "sib_type2_nb_r13_s". Other members of the struct that are not functions I can access and modify without any problems, but calling the member functions like "pack" is giving me this error.
Any help is appreciated