【发布时间】:2014-02-22 17:11:06
【问题描述】:
我使用 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*' 类型的无效操作数 二进制'运算符+'
如何解决?
【问题讨论】:
-
你不能用 + 操作符把 C 风格的字符串加在一起
-
先连接字符串,然后然后在连接的
std::string上调用.c_str()