Reputation: 1950
I am trying to compile a C++ program using make. I want it to read the source files from the src folder. Place the object files in the build folder, and put the exe in the bin folder.
I get the following error
/bin/wavfiletool.exe -g -O2 process_begin: CreateProcess(NULL, /bin/wavfiletool.exe -g -O2, ...) failed. make (e=2): The system cannot find the file specified.
UPDATE: The problem was I put g++ in for my compiler var instead of &(CC)...woops.
But now it says g++: fatal error: no input files I am running make using a batch file that sets the environment variables.
SET PATH=C:\Make\GnuWin32\bin;C:\MinGW\bin
make %1
My makefile is as follows.
CC := g++
CFLAGS := -g -O2
BIN_DIR := /bin
BUILD_DIR := /build
SRC_DIR := /src
TARGET := wavfiletool.exe
SOURCES := $(wildcard $(SRC_DIR)/*.c)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
$(BIN_DIR)/$(TARGET): $(OBJECTS)
$(G++) $@ $(CFLAGS) $(OBJECTS)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
@$(CC) $(CFLAGS) -c $< -o $@
Upvotes: 1
Views: 3628
Reputation: 81052
You haven't set the $(G++)
variable anywhere so the recipe line for the $(BIN_DIR)/$(TARGET)
target is trying to run $@
instead of the compiler.
Also you are missing -o
on that compilation line so were $(G++)
set to g++
correctly you would end up running:
g++ /bin/wavfiletool.exe -g -O2 $(OBJECTS)
which likely isn't what you want.
That being said you probably don't want to be writing directly into /bin
either. Did you mean ./bin
for a bin
directory in the local directory?
Upvotes: 2