[Solved] Warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Codes:

static int CheckOneReg(uint8_t busNo, char *title, int32_t addr, uint32_t *val, BOOL isPrintfNL, ErrMsg_t const *pMsg)

res |= CheckOneReg(busNo,"fwVer:", HALREG_FW_VER, &val, true, NULL);
res |= CheckOneReg(busNo, "status-0:", HALREG_SYS_STATUS_0 + 0, &val, true, MsgTbl_a3SysStatus);

Error:

ptr2ptr.cpp:224:86: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
res |= CheckOneReg(busNo, (const char *)”fwVer:”, HALREG_FW_VER, &val, true, NULL);
^
ptr2ptr.cpp:225:99: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
res |= CheckOneReg(busNo, “status-0:”, HALREG_SYS_STATUS_0 + 0, &val, true, MsgTbl_a3SysStatus);

How to Solve:

New Codes:

static int CheckOneReg(uint8_t busNo, char const *title, int32_t addr, uint32_t *val, BOOL isPrintfNL, ErrMsg_t const *pMsg)

Similar Posts: