CJCoding With Joseph
15free / daySign inCreate account

University of Lethbridge - CPSC

Using a Makefile in VS 2022 (with NMake)

Assignment 2 - Recurrence - SM 25

This project requires a Makefile. A Makefile is a text file that defines rules for compiling and linking your code. It tells the compiler how to build your program using commands like cl.exe and link.exe. We will use nmake, which comes included with Visual Studio.

If you are on windows and using Visual Studio then we will use nmake, which comes bundled with Visual Studio, instead of GNU make.

If you are on a Mac or using the command terminal, go to the bottom of this page to see how to use a Makefile.


Step 1: Create a Makefile Project

  1. In Visual Studio 2022, go to File → New → Project.

  2. Search for Makefile Project under C++.

  3. Select Makefile Project, give it a name, and click Create.

  4. When prompted, enter the following NMake commands:

    • Build Command Line: nmake /f makefile

    • Rebuild Command Line: nmake /f makefile clean && nmake /f makefile

    • Clean Command Line: nmake /f makefile clean

    • Output: recseq.exe

Members only

Keep reading this lesson

You've reached the end of the free preview. Unlock the rest of this lesson plus 27 more lessons in University of Lethbridge - CPSC.

  • Unlimited coding questions
  • Unlimited access to all classroom material
  • Weekly live call for questions and guidance
  • 3,000 AI tutor tokens / month
  • Personal SQL database (3 MB)
  • Progress tracking

Cancel any time.