title: How to fix error in function `_start': (.text+0x20): undefined reference to `main'
body: <p>I am running Ubuntu 18.0.4 virtual machine using Vagrant and Virtualbox. I am writing a C program to manage virtual memory on said machine, which consists of many C and header files. Every time I run make while in my virtual machine, I get this error:</p>
  
  <pre><code>make[1]: Entering directory '/vagrant'
  /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In 
  function `_start':
  (.text+0x20): undefined reference to `main'
  collect2: error: ld returned 1 exit status
  Makefile:45: recipe for target 'vm-sim' failed
  make[1]: *** [vm-sim] Error 1
  make[1]: Leaving directory '/vagrant'
  Makefile:23: recipe for target 'all' failed
  make: *** [all] Error 2
  </code></pre>
  
  <p>Here is my Makefile:</p>
  
  <pre><code>TARGET = vm-sim
  CC     = gcc
  CFLAGS = -Wall -Wextra -Wsign-conversion -Wpointer-arith -Wcast-qual - 
  Wwrite-strings -Wshadow -Wmissing-prototypes -Wpedantic -Wwrite-strings -g - 
  std=gnu99 -lm
  
  LFLAGS =
  
  SRCDIR = *-src
  INCDIR = $(SRCDIR)
  BINDIR = .
  
  SUBMIT_FILES  = $(SRC) $(INC) Makefile
  SUBMISSION_NAME = project3-vm
  
  SRC := $(wildcard $(SRCDIR)/*.c)
  INC := $(wildcard $(INCDIR)/*.h)
  
  INCFLAGS := $(patsubst %/,-I%,$(dir $(wildcard $(INCDIR)/.)))
  
  .PHONY: all
  all:
  @$(MAKE) release &amp;&amp; \
  echo "$$(tput setaf 3)$$(tput bold)Note:$$(tput sgr0) this project compiled 
  with release flags by default. To compile for debugging, please use $$(tput 
  setaf 6)$$(tput bold)make debug$$(tput sgr0)."
  
  .PHONY: debug
  debug: CFLAGS += -ggdb -g3 -DDEBUG
  debug: $(BINDIR)/$(TARGET)
  
  .PHONY: release
  release: CFLAGS += -mtune=native -O2
  release: $(BINDIR)/$(TARGET)
  
  .PHONY: clean
  clean:
  @rm -f $(BINDIR)/$(TARGET)
  @rm -rf $(BINDIR)/$(TARGET).dSYM
  
  .PHONY: submit
  submit:
  @(tar zcfh $(SUBMISSION_NAME).tar.gz $(SUBMIT_FILES) &amp;&amp; \
  echo "Created submission archive $$(tput 
  bold)$(SUBMISSION_NAME).tar.gz$$(tput sgr0).")
  
  $(BINDIR)/$(TARGET): $(SRC) $(INC)
  @mkdir -p $(BINDIR)
  @$(CC) $(CFLAGS) $(INCFLAGS) $(SRC) -o $@ $(LFLAGS)
  </code></pre>
  
  <p>I only have one main() function defined, but previously defined a different one in another file; I think this may be the issue but don't know how to fix it.</p>