0

我使用 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 行生成此问题:

'const char [60]' 和 'const char*' 类型的无效操作数到二进制 'operator+'

如何解决?

4

1 回答 1

3

你会想要这样的东西:

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);
于 2014-02-22T17:16:11.843 回答