Put .o and .exe in separate folder

How do I have make put the .o and .exe files generated in a separate folder?
I think you should put this in the Windows Programming forum. The answer depends on which programming environment you're using (Visual Studio, Dev C++ etc.)
I am using make, which is originally a Linux/Unix tool, but I have the MinGW version. This is not Windows-specific.
Only windows have .exe files, so I assumed it was.

If you edit your makefiles directly, you can simply tell the compiler where to put all files. E.g.

1
2
3
4
5
6
7
8
9
10
11
12
13
BIN_DIR=bin
OBJ_DIR=.obj

TARGET=$(BIN_DIR)/program.exe
OBJECT=$(OBJ_DIR)/program.o

default: $(TARGET)

$(TARGET): $(OBJECT)
    g++ -o $(TARGET) $(OBJECT)

$(OBJECT): program.cpp
    g++ -c -o $(OBJECT) program.cpp

Thanks!
Topic archived. No new replies allowed.