title: How do I use g++ to create object file with a specific name
body: <p>I am making a makefile and one of the targets is exptrtest.o how do I use g++ to create an objectfile with that name, the name of my cpp file is exprtest.cpp not exptrtest.cpp?</p>
  
  <pre><code>exptrtest.o: exprtest.cpp
      g++ -Wall -g -c exprtest.cpp
  </code></pre>
  
  <p>to make it more clear, this is my makefile:</p>
  
  <pre><code>all: exprtest
  exprtest: exptrtest.o driver.o parser.tab.o scanner.o
      g++ -Wall -g -o exprtest exptrtest.o driver.o parser.tab.o scanner.o
  exptrtest.o: exprtest.cpp
      g++ -Wall -g -c exptrtest.o exprtest.cpp
  driver.o: driver.cpp scanner.hpp driver.hpp
      g++ -Wall -g -c driver.cpp
  parser.tab.o: parser.tab.hpp parser.tab.cpp
      bison parser.ypp
      g++ -Wall -g -c parser.tab.cpp
  scanner.o: scanner.cpp scanner.hpp
      flex -t scanner.ll &gt; scanner.cpp
      g++ -Wall -g -c scanner.cpp
  clean:
      rm parser.tab.hpp parser.tab.cpp scanner.cpp
  </code></pre>
  
  <p>I'm getting the error:
  "g++: error: exptrtest.o: No such file or directory
  make: <em>*</em> [exprtest] Error 1"</p>