How to resolve " invalid operands of types 'const char [ ]' and 'const char*' to binary 'operator+' "

StackOverflow https://stackoverflow.com/questions/21957516

  •  15-10-2022
  •  | 
  •  

문제

I use Qt Creator and this code :

string execpath = "";
execpath += (QCoreApplication::applicationDirPath()).toStdString();
WinExec("ffmpeg -f dshow -t 32 -i audio=\"virtual-audio-capturer\" -y "+(execpath.c_str())+"\\sound.mp3", SW_HIDE); // Loopback captured in sound.mp3

generate this issue on line 3 :

invalid operands of types 'const char [60]' and 'const char*' to binary 'operator+'

How to solve it?

도움이 되었습니까?

해결책

You'll want something like:

execpath += (QCoreApplication::applicationDirPath()).toStdString();
std::string cmd = "ffmpeg -f dshow -t 32 -i audio=\"virtual-audio-capturer\" -y "
WinExec((cmd +execpath +"\\sound.mp3").c_str(), SW_HIDE);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top