【发布时间】:2019-12-15 07:48:08
【问题描述】:
我试图使用 PlaySound(); C++ 中的函数。我想接受用户输入他们想要播放的文件。但是当我将变量放入 PlaySound();它给了我一个错误。这是代码,
#include <string>
#include <Windows.h>
using namespace std;
int main()
{
cout << "Enter song name...\nMake sure the song is in the same folder as this program\n";
string filename;
getline(cin, filename);
cout << "Playing song...\n";
bool played = PlaySound(TEXT(filename), NULL, SND_SYNC);
return 0;
}
错误,
identifier "Lfilename" is undefined
'Lfilename': undeclared identifier
我正在使用 Microsoft Visual Studio 2019。
【问题讨论】:
-
Edit 包含您收到的错误消息的问题。