1. Linux:
std::string strExepath(_pgmptr);
2.VS:
char arrPath[MAX_PATH_LENGTH];
memset(arrPath, 0, sizeof(char) * MAX_PATH_LENGTH);
GetModuleFileName(NULL, arrPath, MAX_PATH_LENGTH);
std::string strExeName(arrPath);
3.QT
QCoreApplication::applicationDirPath();
QCoreApplication::applicationFilePath();
QCoreApplication::applicationName();
https://blog.youkuaiyun.com/lion_cxq/article/details/126395144