You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to port a game developed by sdl2. And this game uses SDL_ mixer to play sound. But when I link the SDL_mixer in cmake, it doesn't compile properly.
I try to test SDL_mixer in a new project:
...
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
int main(void) {
if (SDL_Init(SDL_INIT_AUDIO) == -1) return -1;
Mix_Music *sound=Mix_LoadMUS("ux0:data/sound.wav");
...
Sorry, the libraries I linked in cmake are in the wrong order.
quote from $ man ld:
The linker will search an archive only once, at the location where it is specified on the command line. If the archive
defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker
will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the
command line will not cause the linker to search the archive again.
I'm trying to port a game developed by sdl2. And this game uses SDL_ mixer to play sound. But when I link the SDL_mixer in cmake, it doesn't compile properly.
I try to test SDL_mixer in a new project:
here is my target_link_libraries:
And I got:
Please help me solve this problem. I’m truly grateful for your help.
The text was updated successfully, but these errors were encountered: