我使用 Qt Creator 和这段代码:
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
在第 3 行生成此问题:
invalid operands of types 'const char [60]' and 'const char*' to binary 'operator+'
如何解决?
最佳答案
你会想要这样的东西:
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);
关于c++ - 如何解析 "invalid operands of types ' const char [ ]' and ' const char *' to binary ' operator +' ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21957516/