我无法在代码块中编译我的 SDL 项目
I can't compile my SDL project in CodeBlocks
构建日志
-------------- Build: Debug in SDLTEST (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -LC:MingwLibsSDL2-2.0.3lib -o binDebugSDLTEST.exe objDebugmain.o -lmingw32 -lSDL2main -lSDL2
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL2main
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL2
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
我的代码
当我使用标签时,它使include变为粗体。
(#)include <stdio.h>
(#)include <SDL.h>
using namespace std;
int main( int argc, char* args[] )
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
return 0;
}
我的链接器
-lmingw32 -lSDL2main -lSDL2
看起来您的库搜索路径错误。SDL2的标准分发包在lib文件夹中包含两个文件夹,但您可以直接将路径设置为
-LC:\MingwLibs\SDL2-2.0.3\lib
尝试使用C:\MingwLibs\SDL2-2.0.3\lib\x86或C:\MingwLibs\SDL2-2.0.3\lib\x64作为库路径
相关文章:
- 为什么 emscripten 不编译我的函数?
- Qt - 为什么Visual Studio 2019在qml资源中添加10Mb文件后无法再编译我的项目?
- 编译我的 3 个文件时,我收到错误,说"运算符="不匹配
- 为什么clang仍然需要libgcc.a来编译我的代码
- 为什么Visual Studio 2019不编译我的代码?
- G++ 在编译我的 flex 和 bison 代码时无法识别我的 c++ 类
- 当我编译我的程序时,它显示"分段错误(或)分段错误(核心转储)
- 当我构建和编译我的C 项目时,没有通过我的CMake文件找到正确的C 库,我在做什么错
- 尝试编译我的程序时出现 3 个链接错误
- 编译我的C++代码需要很长时间
- 当我尝试使用 makefile 编译我的 qt 程序时,它不起作用
- 初学者C - 编译我的代码时遇到困难
- 为什么 OSX Mavericks 无法编译我的 GLSL 着色器?
- 用 C::B 编译我的第一个应用程序
- 尝试编译我的 wxWidgets 程序时出错"is_enum not declared in this scope"
- 编译我的第一个c++程序时遇到问题
- 编译我的第一个C++程序时遇到问题
- Visual C++ 没有编译我的代码
- g++ 无法编译我的复杂模板实例化
- 为什么我在尝试编译我的第一个 CORBA 服务器(使用 ACE/TAO ORB 实现)时遇到链接器错误