I use mingw32 to compile some C++ code. After trying some things and a lot of search I have a questions : The flags orders seems very important thought I found barely nothing that explain that on the internet. For exemple :
g++ main.cpp -L/lib -I/include -lmingw32 -lSDL2 -lSDL2main -Wall -g -o main.exe -> Compile
g++ main.cpp -L/lib -I/include -lmingw32 -lSDL2main -lSDL2 -Wall -g -o main.exe -> Not compile
g++ main.cpp -L/lib -I/include -lSDL2 -lSDL2main -lmingw32 -Wall -g -o main.exe -> Compile
I can understand why -lSDL2main need -lSDL2 first but so why the place of -lmingw32 is not important ?
EDIT :
I explain : from what I know of compilation process .cpp come first, -l indicate clearly libraries (last step of compilation). So why if I put main.cpp to the end it's continue compilation process and finish with error from the library. What mingw use if he don't have any source file, he just compile lib ?