I try on a simple example:

#include <iostream> using namespace std; #include "windows.h" #include "mmsystem.h" int main() { PlaySound(TEXT("tet.wav"),NULL, SND_SYNC); system("pause"); return 0; } 

but gives out

undefined reference to `__imp_PlaySoundA '

Like .lib is needed as far as I know, but how to connect it to CLion`e?

  • Tried to add target_link_libraries(цель бибилотека) in CMakeLists.txt ? - Vladimir Gamalyan
  • No, with CMake, unfortunately I am a "stranger". Could you explain in detail how to connect through it? - pavel5243

1 answer 1

If you want to use Clion then you should study cmake, otherwise under Windows only visual studio.

Here is a Russian-language link to a small manual.

If in short, you need:

 find_package(libName REQUIRED)//найти нужную библиотеку include_directories(${INCLUDE_DIRS})//добавить найденные инклуды которые хранятся в ${INCLUDE_DIRS} target_link_libraries(test libName)//теперь осталось только подключить либу 

These are common actions. Depending on whether they may differ, I strongly recommend that you study cmake .