So, I am using Twinklebear's tutorial on setting up SDL2 for MinGW(Website here ---> http://www.willusher.io/sdl2%20tutorials/2013/08/15/lesson-0-mingw/). Now, I am using CodeLite 5.4 as my IDE and I don't really know how to tweak my IDE so that it generates the right makefile to run this sample code below:
#include <iostream>
#include <SDL2/SDL.h>
int main(int argc, char **argv){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0){
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Quit();
return 0;
}
Here is the makefile I want to use:
CXX = g++
SDL_LIB = -LC:/SDL2Dev/lib -lSDL2main -lSDL2
SDL_INCLUDE = -IC:/SDL2Dev/include
CXXFLAGS = -Wall -c -std=c++11 $(SDL_INCLUDE)
LDFLAGS = -lmingw32 -mwindows -mconsole $(SDL_LIB)
EXE = SDL_Lesson0.exe
all: $(EXE)
$(EXE): main.o
$(CXX) $< $(LDFLAGS) -o $@
main.o: main.cpp
$(CXX) $(CXXFLAGS) $< -o $@
clean:
del *.o && del $(EXE)
But, when I go to build it, I get this
MESSAGE: Entering directory `C:\Users\user\Documents\SDL2Custom\'
C:\Windows\system32\cmd.exe /c "make"
----------Building project:[ SDL2Custom - Debug ]----------
'make' is not recognized as an internal or external command,
operable program or batch file.
0 errors, 0 warnings
I am extremely new to this stuff as I just depended on my IDE to do the dirty work for me. I really want to use the SDL2 library for making games in the future, so can anyone please explain to me how to do this?
Oh, I do have all the development library downloaded. For me, it's located in C:/SDL2Dev and it contains the 32 bit library.
CodeLite 5.4 installer comes with MinGW bundled (TDM-GCC 4.8.1) So you probably have it installed (MinGW that is)
However, MinGW uses mingw32-make.exe
and not make
So change that in your project settings:
Right click on the project icon in the tree view (on the left side) or hit Alt+F7
Settings->Common Settings->Customize->Custom Build
, double click on the Build
target and change the command to: mingw32-make.exe -j4
the -j4
means: run 4 processes to compile at the same time ( this usually boosts compilation time)
Eran