# Failing to link mixer on WSL Ubuntu

**URL:** <https://discourse.libsdl.org/t/failing-to-link-mixer-on-wsl-ubuntu/52134>\
**Category:** Game Development\
**Created:** [June 19, 2024, 6:59pm UTC](https://discourse.libsdl.org/t/failing-to-link-mixer-on-wsl-ubuntu/52134 "2024-06-19T18:59:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GaberielSDL](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/b2d939/32.png) [@GaberielSDL](https://discourse.libsdl.org/u/GaberielSDL)\
**Post date:** [June 19, 2024, 6:59pm UTC](https://discourse.libsdl.org/t/failing-to-link-mixer-on-wsl-ubuntu/52134/1 "2024-06-19T18:59:04Z")

</div>

I’ve been developing with SDL2 in Windows for quiet a while and am trying to compile in WSL so I can use valgrind.

Here is how my compilation command includes linking and including the necessary library and header filles (with -I libs/SDL2 -L libs/SDL2/lib at the top

![image](https://discourse.libsdl.org/uploads/default/original/2X/0/02af73a508f55961c1dcc7e9f881506bc09400c0.png)

under _libs/SDL2_ I have all of the headers:

 ![image](https://discourse.libsdl.org/uploads/default/original/2X/d/d4cdadbd4aaba8da500c3fe136655ce2772dee4c.png)

under _libs/SDL2/lib_ I have the necessary library files:

 ![image](https://discourse.libsdl.org/uploads/default/original/2X/c/c5650a60b5c18e485c7b53a1af66cbb2522ea9d0.png)

so I’m not really sure why I get these error when I compile:  
/usr/bin/ld: /tmp/ccoNxkIy.o: in function …cpp:61: undefined reference to Mix\_LoadWAV  
/usr/bin/ld: /tmp/ccoNxkIy.o: in function …cpp:68: undefined reference to Mix\_PlayChannel  
collect2: error: ld returned 1 exit status

I’m not sure what could be wrong at this point. If any of you have any ideas, please let me know, thanks.

---

<div class="post-metadata">

**Author:** ![yataro](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/y/6de8d8/32.png) [@yataro](https://discourse.libsdl.org/u/yataro)\
**Post date:** [June 19, 2024, 9:40pm UTC](https://discourse.libsdl.org/t/failing-to-link-mixer-on-wsl-ubuntu/52134/2 "2024-06-19T21:40:24Z")

</div>

`Mix_LoadWAV` and `Mix_PlayChannel` were macros in Mixer 2.0.0, but were later refactored into functions. You are probably using includes (maybe from system installed SDL?) from more recent SDL\_mixer. Either update your used SDL\_mixer or fix the includes.

---

<div class="post-metadata">

**Author:** ![Mathias](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@Mathias](https://discourse.libsdl.org/u/Mathias)\
**Post date:** [June 21, 2024, 6:53am UTC](https://discourse.libsdl.org/t/failing-to-link-mixer-on-wsl-ubuntu/52134/3 "2024-06-21T06:53:50Z")

</div>

I looked at my `/usr/include/SDL_mixer.h` on my Linux Mint.  
I can see that there is a macro there.

```auto
#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1)

```

---

<div class="post-metadata">

**Author:** ![GaberielSDL](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/b2d939/32.png) [@GaberielSDL](https://discourse.libsdl.org/u/GaberielSDL)\
**Post date:** [July 16, 2024, 12:29pm UTC](https://discourse.libsdl.org/t/failing-to-link-mixer-on-wsl-ubuntu/52134/4 "2024-07-16T12:29:19Z")

</div>

When I switched to dual-booting Ubuntu, compilation worked first try
