Hi! I'm programming C++ in windows and I am compiling using a Makefile. Since I've just got started using makefiles, I'm not very good at coding them. I basically just tried to mimic an already existing makefile for another project. Anyway, here is what my Makefile currently looks like (after reading the Makefile you can skip down to my second post, since I realized that this error was caused by an incorrect installation of SDL):
Code:
CC=g++
CPPFLAGS=-Wall
CPPFLAGS+=-I..
CPPFLAGS+=-lmingw32 -lSDLmain -lSDL
CPPFLAGS+=-mwindows
SRC=main.cpp #../imanip/imanip.cpp #../imanip/imfuncs.cpp
OBJ=$(SRC:.cpp=.o)
OUT=image_test.exe
all: $(OUT)
rm $(OBJ) #Remove .o
$(OBJ) :
$(CC) $(SRC) $(CPPFLAGS) -c #Create .o
$(OUT) : $(OBJ)
$(CC) $(OBJ) $(CPPFLAGS) -o $@ #Link .
I'm compiling using mingw32-make.exe and g++, both in the mingw package. g++ complains though, when compiling from emacs, and here is what comes up in the split window in emacs:
Code:
mingw32-make -k
g++ main.o -Wall -I.. -lmingw32 -lSDLmain -lSDL -mwindows -o image_test.exe #Link .
g++: #Link: No such file or directory
mingw32-make: *** [image_test.exe] Error 1
mingw32-make: Target `all' not remade because of errors.
It looks like mingw32-make.exe is trying to parse what comes after the '#', but that should be interpreted as a comment, right?
The project by the way uses SDL. The code I have written is split up in two different folders, with the main function in a file lying in the same directory as the Makefile.
Edit: Strange. Anyway, I tried removing the comment (#Link .), and here is what it says instead:
Code:
mingw32-make -k
g++ main.o -Wall -I.. -lmingw32 -lSDLmain -lSDL -mwindows -o image_test.exe
C:\Program1\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lSDLmain
collect2: ld returned 1 exit status
mingw32-make: *** [image_test.exe] Error 1
mingw32-make: Target `all' not remade because of errors.
I don't understand much of this; I wrote the Makefile along with the code files long time ago on another computer, and I am now trying to make the same project I wrote back then compile with the same files and the same code. I have little knowledge of makefiles though. The project has compiled before and I find it funny that a bunch of new problems shall arise everytime you try to compile old projects that you know has compiled before.
I have installed the SDL development package on this computer, following the steps given in Lazy Foo' Productions.