title: Breakpoints not hit while debugging c++ in Visual Studio Code
body: <p><strong>System:</strong> POP OS
  <strong>IDE:</strong> Visual Studio Code</p>
  <p>I am attempting to debug a simple c++ project. When I initially set up the project, the debugger would function as expected. When I added a makefile, breakpoints were no longer hit. Before adding the makefile I compiled from a task.json file with <strong>g++ -g -o main.o main.cpp</strong>. This command obviously didn't do what the makefile is doing, but debugging DID work in my environment.</p>
  <p>Setting launch.json to stopAtEntry also does not work. So my assumption is that I am compiling incorrectly.</p>
  <p><strong>Makefile output:</strong></p>
  <p>g++ -Wall -I./header -L./lib   -c -o source/MqttManager.o source/MqttManager.cpp</p>
  <p>g++ -g -o bin/debug/GenericMqttClient source/main.o source/MqttManager.o -Wall -I./header -L./lib  -lpaho-mqtt3c</p>
  <p>rm -r ./source/*.o</p>
  <p>Here are the relevant files:</p>
  <p><strong>launch.json</strong></p>
  <pre><code>   {
      &quot;version&quot;: &quot;0.2.0&quot;,
      &quot;configurations&quot;: [
          {
              &quot;name&quot;: &quot;g++ - Build and debug active file&quot;,
              &quot;type&quot;: &quot;cppdbg&quot;,
              &quot;request&quot;: &quot;launch&quot;,
              &quot;program&quot;: &quot;${workspaceFolder}/bin/debug/GenericMqttClient&quot;,
              &quot;args&quot;: [],
              &quot;stopAtEntry&quot;: false,
              &quot;cwd&quot;: &quot;${workspaceFolder}&quot;,
              &quot;environment&quot;: [],
              &quot;externalConsole&quot;: false,
              &quot;MIMode&quot;: &quot;gdb&quot;,
              &quot;setupCommands&quot;: [
                  {
                      &quot;description&quot;: &quot;Enable pretty-printing for gdb&quot;,
                      &quot;text&quot;: &quot;-enable-pretty-printing&quot;,
                      &quot;ignoreFailures&quot;: true
                  }
              ],
              &quot;preLaunchTask&quot;: &quot;C/C++: g++ build active file&quot;,
              &quot;miDebuggerPath&quot;: &quot;/bin/gdb&quot;
          }
      ]
  }
  </code></pre>
  <p><strong>Makefile</strong></p>
  <pre><code>CXX = g++
  EXENAME = GenericMqttClient
  
  #   Directories
  HDIR = ./header
  LDIR = ./lib
  ODIR = ./obj
  SDIR = ./source
  BIN = ./bin
  DEBUGDIR = $(BIN)/debug
  RELDIR = $(BIN)/release
  
  # Project Files
  SRC = $(wildcard $(SDIR)/*.cpp)
  OBJ = $(SRC:.cpp=.o)
  
  # Includes
  DEPS = $(HDIR)/MqttManager.h
  LIBS = -lpaho-mqtt3c
  
  #flags
  CXXFLAGS = -Wall -I$(HDIR) -L$(LDIR)
  # DEBUGFLAGS = $(CXXFLAGS) -g
  
  # Object files
  $(SDIR)/%.o: %.cpp $(DEPS)
      $(CXX) -c -o $@ $&lt; $(CXXFLAGS) $(LIBS)
  
  # Release
  release: prep $(RELDIR)/$(EXENAME) objclean
  $(RELDIR)/$(EXENAME): $(OBJ)
      $(CXX) -o $@ $^  $(CXXFLAGS) $(LIBS) 
  
  # Debug
  debug: prep $(DEBUGDIR)/$(EXENAME) objclean
  $(DEBUGDIR)/$(EXENAME): $(OBJ)
      $(CXX) -g -o $@ $^ $(CXXFLAGS)  $(LIBS)
  
  #
  #   Other Rules
  #
  all: clean debug release objclean
  
  prep:
      @mkdir -p $(DEBUGDIR) $(RELDIR)
  
  objclean:
      rm -r $(SDIR)/*.o
  
  clean:
      rm -rf $(BIN)/*
  </code></pre>
  <p>Let me know if I should include more files.</p>