Mình tìm hiểu trên mạng cách thêm thư viện SDL vào dev c++ và thực hiện theo đúng các bước của bài viết này: “Series hướng dẫn dùng SDL cơ bản”
Nhưng khi mình test 1 chương trình c++
#include <windows.h>
#include <iostream>
int main()
{
std::cout << "hello";
return 0;
}
thì nó hiển thị ra lỗi này:
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib/libSDL2main.a when searching for -lSDL2main
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib\libSDL2main.a when searching for -lSDL2main
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib/libSDL2main.a when searching for -lSDL2main
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe cannot find -lSDL2main
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib/libSDL2.dll.a when searching for -lSDL2
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib/libSDL2.a when searching for -lSDL2
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib\libSDL2.a when searching for -lSDL2
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib/libSDL2.dll.a when searching for -lSDL2
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible E:/Apps/laptrinh/game/SDL/lib/libSDL2.a when searching for -lSDL2
C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe cannot find -lSDL2
E:\Apps\laptrinh\game\collect2.exe [Error] ld returned 1 exit status
25 E:\Apps\laptrinh\game\Makefile.win recipe for target 'SDL_G.exe' failed
trên màn hình nhập là:
# Project: SDL
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = GameSDL.o
LINKOBJ = GameSDL.o
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -L"E:/Apps/laptrinh/game/SDL/lib" -lmingw32 -lSDL2main -lSDL2 -m32
INCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"E:/Apps/laptrinh/game/SDL/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -I"E:/Apps/laptrinh/game/SDL/include"
BIN = SDL_G.exe
CXXFLAGS = $(CXXINCS) -m32
CFLAGS = $(INCS) -m32
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)
GameSDL.o: GameSDL.cpp
$(CPP) -c GameSDL.cpp -o GameSDL.o $(CXXFLAGS)
Mong mấy ace giúp mình xử lý lỗi này với? Cảm ơn!