I’ve gotten fed up with MSVC++6 and how everyone is always telling me that it’s a crappy compiler and such.
So now I’ve decided to try to use vim plus g++ and makefiles. Here’s my problem; I have the following makefile:
# This is supposed to be a comment.. CC = g++ # The line above sets the compiler in use.. # The next line sets the compilation flags CFLAGS=-c -Wall all: main.exe main.exe: main.o Accel.o $(CC) -o main.exe main.o Accel.o main.o: main.cpp Accel.h $(CC) $(CFLAGS) main.cpp Accel.o: Accel.cpp Accel.h $(CC) $(CFLAGS) Accel.cpp clean: del main.exe *.o
This gives an error when trying to make, because I need to link to a windows library called Ws2_32.lib, which is needed by Winsock2.h, which I include in one of my .h files.
So how do I do this? I’ve tried the -l option, but I can’t make it work. How does it work with a path that has spaces?
First step: locate the library you are looking for. For me, it’s in :
Second step, pass that directory with -L :
Third step, pass the name of the library with -l (lowercase L):
Then use it: