SDL2 makefile错误

时间:2015-02-03 11:25:26

标签: c linker-errors sdl-2

我试图为我的SDL2项目创建一个makefile。但链接器无法找到" -lSDL2"。我正在使用GCC 4.9.2。

这是makefile:

# Files to be compiled
OBJS = main.c

# Compiler
CC = gcc

# Include paths
INCLUDE_PATHS = -ID:\George\SDL2-2.0.3\i686-w64-mingw32\include\SDL2

# Library paths
LIBRARY_PATHS = -LD:\George\SDL2-2.0.3\i686-w64-mingw32\lib

# Compiler flags
COMPILER_FLAGS = -Wall

# Linker flags
LINKER_FLAGS = -lmingw32 -lSDL2main -lSDL2

# Executable file
OBJ_NAME = main

# Compile command
all: $(OBJS)
    $(CC) $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)

以下是我运行" make"时出现的错误。命令:

D:\George\Projects>make
gcc main.c -ID:\George\SDL2-2.0.3\i686-w64-mingw32\include\SDL2 -LD:\George\SDL2
-2.0.3\i686-w64-mingw32\lib -Wall -lmingw32 -lSDL2main -lSDL2 -o main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2main.a when searching for -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib\libS
DL2main.a when searching for -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2main.a when searching for -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.dll.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib\libS
DL2.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.dll.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lSDL2
collect2.exe: error: ld returned 1 exit status
makefile:24: recipe for target 'all' failed
make: *** [all] Error 1

D:\George\Projects>

如果有人能帮助我,我将非常感激。

0 个答案:

没有答案