Библиотеки аддонов SDL неправильно связываются

Я пытался связать SDL_mixer, SDL_ttf и SDL_image с моим проектом, но по какой-то причине эти ошибки появляются при компиляции моего кода. Заголовочные файлы, которые я включил, зависят от библиотек над ним. Я связался с моей библиотекой в ​​следующем порядке:

mingw32
OpenGL32
SDLmain
SDL
SDL_image
SDL_ttf
SDL_mixer

#include <map>
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
#include <GL/gl.h>
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>

using namespace std;

#include "include_file.h"#include "structure.h"#include "player.h"#include "healthclass.h"#include "items.h"#include "loadfiles.h"#include "init_game.h"#include "missions.h"

Тогда ошибка:

obj\Release\main.o:main.cpp:(.text+0x16e): undefined reference to `Mix_LoadMUS'
obj\Release\main.o:main.cpp:(.text+0x197): undefined reference to `Mix_LoadWAV_RW'
obj\Release\main.o:main.cpp:(.text+0x1c0): undefined reference to `Mix_LoadWAV_RW'
obj\Release\main.o:main.cpp:(.text+0x1e9): undefined reference to `Mix_LoadWAV_RW'
obj\Release\main.o:main.cpp:(.text+0x7cd): undefined reference to `IMG_Load'
obj\Release\main.o:main.cpp:(.text+0x996): undefined reference to `TTF_RenderUTF8_Shaded'
obj\Release\main.o:main.cpp:(.text+0x20ca): undefined reference to `Mix_CloseAudio'
obj\Release\main.o:main.cpp:(.text+0x20cf): undefined reference to `TTF_Quit'
obj\Release\main.o:main.cpp:(.text+0x2f7b): undefined reference to `IMG_Load'
obj\Release\main.o:main.cpp:(.text+0x3788): undefined reference to `TTF_Init'
obj\Release\main.o:main.cpp:(.text+0x37ac): undefined reference to `Mix_OpenAudio'
obj\Release\main.o:main.cpp:(.text+0x3914): undefined reference to `TTF_OpenFont'
obj\Release\main.o:main.cpp:(.text+0x3983): undefined reference to `Mix_PlayMusic'
obj\Release\main.o:main.cpp:(.text+0x61f0): undefined reference to `Mix_PlayChannelTimed'
obj\Release\main.o:main.cpp:(.text+0x6330): undefined reference to `Mix_Playing'

1

Решение

Я обнаружил, что пытался скомпилировать 32-битную версию SDL с 64-битной версией SDL_image, SDL_mixer и SDL_ttf. Поэтому, когда вы устанавливаете библиотеку надстройки, при установке файлов библиотеки используйте папку x86 вместо папки x64. Неважно, если у вас есть 64-битный компьютер, если SDL 32-битный, то используйте папку x86 lib, если вы не знаете, что делаете, чего я не знал.

5

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector