c++播放音频( c++ play audio),为C++应用程序添加启动音效
c++播放音频
0、使用的IDE : CLion
1、CMAKE中
cmake_minimum_required(VERSION 3.21)
project(Cpp)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_EXE_LINKER_FLAGS "-static")
add_executable(cheatMain main.cpp)
# Link to GLFW, GLEW and OpenGL
target_link_libraries(cheatMain PUBLIC
${GLFW_LIBRARIES}
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES}
winMM.Lib
)
2、main.cpp中
int main {
PlaySound(TEXT("C:\\Users\\x'x'xxx\\Documents\\GitHub\\xx\\Cpp\\go.wav"),NULL, SND_ASYNC);
}
===================DEBUG的新路历程===============================
clion

clion 添加link -Winmm.lib


clion undefined reference to `__imp_PlaySoundA'

播放出来的声音是 叮咚,不是我的音频
我的天
Instead of using relative path Use an absolute path

浙公网安备 33010602011771号