I solve my problem. Here is the code snipped
layer->startEditing();
qDebug()<< "is editable " << layer->isEditable();
QgsFeatureRenderer * layerRenderer= layer->renderer();
QgsSingleSymbolRenderer *mSingleRenderer = QgsSingleSymbolRenderer::convertFromRenderer(layerRenderer);
QgsMarkerSymbol* symbol = new QgsMarkerSymbol();
QgsStringMap mp;
// mp[QString("fill")]= QString("red");
mp[QString("name")]= QString("food_pub.svg");
mp[QString("size")]= QString("6");
// mp[QString("outline")]=QString("black");
// mp[QString("outline-width")]=QString("6.8");
QgsSvgMarkerSymbolLayer svglayer("C:\\OSGeo4W64\\apps\\qgis-ltr-dev\\svg\\food\\food_pub.svg");
QgsSymbolLayer* svgsymbol=svglayer.create(mp);
auto newsym= symbol->createSimple(mp);
newsym->changeSymbolLayer(0,svgsymbol);
mSingleRenderer->setSymbol(newsym);
layer->setRenderer(mSingleRenderer);
layer->triggerRepaint();
layer->commitChanges();
qDebug()<< "is editable after commiting " << layer->isEditable();