0

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.

M.M
  • 138,810
  • 21
  • 208
  • 365

3 Answers3

3

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

Eran
  • 2,310
  • 1
  • 13
  • 13
  • I did exactly a you said and now it says => mingw32-make.exe: *** No targets specified and no makefile found. Stop. –  Sep 13 '19 at 08:09
  • Make sure that a `Makefile` is located in the working directory (assuming you are using custom makefile as the OP) – Eran Sep 14 '19 at 13:32
1

'make' is not recognized as an internal or external command, operable program or batch file.

The message means the IDE called make to build the project, but the operating system could not find any sign of a make.exe on that system.

So while the make.exe may or may not be installed, what is clear is the executable install folder is not in the system PATH environment variable.

EDIT: I am assuming you have installed MinGW, in which case look for the make.exe in that install folder and make sure that folder is in the PATH.

jussij
  • 10,370
  • 1
  • 33
  • 49
0

I just fixed my "make" problem. When creating my project in Codelite 13 I accidently selected c++ instead of G++. It created a file with the .c extension instead of .cpp. I changed the extension and it built and ran fine.