I wanted to teach myself SDL, but I encountered quite unpleasant problem in the very first try. I did some research and found out that I first need to make CodeBlocks know where library sits. First things first, I have 64-byte OS.
我想自学SDL,但是我在第一次尝试的时候就遇到了非常不愉快的问题。我做了一些研究,发现我首先需要让代码库知道库的位置。首先,我有64字节的操作系统。
Just as I read, I put things in:
正如我读到的,我把东西放进去:
Project -> Linker settings ( direct links to .dll files, I chose x64 of course ), and "-lmingw32 -lSDL2main -lSDL2" in "other linker options". This one puzzles me a bit, but replacing 32 with 64 generates yet another error, so I kept it that way.
项目->链接器设置(直接链接到.dll文件,当然我选择了x64)和“其他链接器选项”中的“-lmingw32 - lsdl2main - lsdll2”。这让我有点困惑,但是用64替换32会产生另一个错误,所以我一直这样做。
Project -> Search Directories:
项目- >搜索目录:
-> Compiler: link to /include folder with header files
-> Linker: link to /lib folder with .dll files
I also made sure that these things are visible after clicking on project itself and choosing "build options".
在点击项目本身并选择“构建选项”之后,我还确保这些东西是可见的。
Have I forgotten about something?
我忘记什么了吗?
1 个解决方案
#1
0
You must have "compatible" versions of libraries and compiler - I mean architecture, 32 or 64 bits. I see that you using MinGW 32-bits, so always use 32-bits SDL libraries.
您必须有“兼容”版本的库和编译器——我的意思是体系结构,32或64位。我看到您使用的是MinGW 32位,所以总是使用32位的SDL库。
It was about selecting version of SDL library. As for your main question, do you follow all steps about configuring SDL2 in CodeBlocks correctly?
它是关于选择SDL库的版本。关于您的主要问题,您是否正确地执行了在代码库中配置SDL2的所有步骤?
- Search Directories > Compiler > /include
- 搜索目录>编译器> /包括。
- Search Directories > Linker > /lib (this folder should have .lib files, not .dlls)
- 搜索目录>链接器> /lib(此文件夹应该有.lib文件,而不是.dlls)
- Linker settings > Other linker options: -lmingw32 -lSDL2main -lSDL2
- 链接器设置>其他链接器选项:-lmingw32 -lSDL2main - lsdll2
(graphical - In my opinion the best on internet - tutorial is here)
(在我看来,互联网上最好的教程是在这里)
Do not set direct paths to DLL files. If you don't have .lib
files, probably you downloaded wrong package from SDL site.
不要为DLL文件设置直接路径。如果没有。lib文件,很可能是从SDL站点下载了错误的包。
#1
0
You must have "compatible" versions of libraries and compiler - I mean architecture, 32 or 64 bits. I see that you using MinGW 32-bits, so always use 32-bits SDL libraries.
您必须有“兼容”版本的库和编译器——我的意思是体系结构,32或64位。我看到您使用的是MinGW 32位,所以总是使用32位的SDL库。
It was about selecting version of SDL library. As for your main question, do you follow all steps about configuring SDL2 in CodeBlocks correctly?
它是关于选择SDL库的版本。关于您的主要问题,您是否正确地执行了在代码库中配置SDL2的所有步骤?
- Search Directories > Compiler > /include
- 搜索目录>编译器> /包括。
- Search Directories > Linker > /lib (this folder should have .lib files, not .dlls)
- 搜索目录>链接器> /lib(此文件夹应该有.lib文件,而不是.dlls)
- Linker settings > Other linker options: -lmingw32 -lSDL2main -lSDL2
- 链接器设置>其他链接器选项:-lmingw32 -lSDL2main - lsdll2
(graphical - In my opinion the best on internet - tutorial is here)
(在我看来,互联网上最好的教程是在这里)
Do not set direct paths to DLL files. If you don't have .lib
files, probably you downloaded wrong package from SDL site.
不要为DLL文件设置直接路径。如果没有。lib文件,很可能是从SDL站点下载了错误的包。