Makefile In Dev C++

Makefile In Dev C++ Rating: 6,6/10 4302 votes
  • Dec 11, 2013 made with ezvid, free download at To compile a c program by dev c.
  • Add c: Dev-Cpp bin to your path. (But it does appear to find the make utility, which I would assume is in the same directory, so I'm reaching for straws.).
  1. Makefile Win Error In Dev C++
  2. Dev C++ Error 1073741674

I’ve used Make for a lot for small projects, but for larger ones, it was just too tedious. Until recently, there were four things I wanted my build system to do for me that I hadn’t figured out how to do in Make:

  • Out-of-source builds (object files get dumped in a separate directory from the source)
  • Automatic (and accurate!) header dependencies
  • Automatic determination of list of object/source files
  • Automatic generation of include directory flags

Here is a simple Makefile that will do all these things and works with C, C++, and assembly:

Oct 24, 2016 Calling CMake using Visual Studio Code extensibility Installing C/C build tools In order to build your C code you need to make sure you have C/C build tools (compilers, linkers and build systems) installed on your box.

Not too bad!
Also, if you don’t care about out-of-source builds, you can use this even simpler Makefile, which takes advantage of the built-in implicit rules:

To use one of them, put the Make code in a file call Makefile (make sure the TAB characters get copied! Make is very picky about those) and all of your source and headers in the directory or a subdirectory of ./src (you can change this directory by changing SRC_DIRS). Then make sure you have CC and CFLAGS set to what you need for your project or just use the Make defaults.
Then type make.

If you run into issues, running make -d can be helpful.

Here’s an overview of how it works:

Out-of-Source Builds

I want all the artifacts from a build to end up in some directory (I usually name it “./build”) that’s separate from the source. This makes is easy to do a clean (just rm -rf ./build) even if other artifacts besides the ones generated via Make end up there. It also makes a lot of other things, such as grep’ing the source, a lot nicer.

To do this in Make, you mostly just need to prepend your output directory to the beginning of your pattern rules. For example, instead of a pattern like: %.o: %.c, which would map your .c files for .o files in the same directory, you can use $(BUILD_DIR)%.o: %.c.

Automatic Header Dependencies

Handling the header dependencies is perhaps the most tedious thing about using the classic Make technique. Especially since, if you mess it up, you don’t get any explicit errors–things just don’t get re-compiled when they ought to be. This can lead to .o files having different ideas about what types or prototypes look like.

There is documentation for this here. However, the docs seem to assume that the dependency files are generated in a separate step from the compile step, which complicates things.

If you generate the dependency files as part of the compilation step, things get much simpler. To generate the dependency files, all you have to do is add some flags to the compile command (supported by both Clang and GCC):

  • -MMD -MP
    which will generate a .d file next to the .o file. Then to use the .d files, you just need to find them all:
  • DEPS := $(OBJS:.o=.d)
    and then -include them:
  • -include $(DEPS)

Automatic Determination of List of Object/Source Files

First, find all of the source files in the given source directories. The simplest and fastest way I found to do this was to just shell out and use find.

  • SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
    But because Make works backward from the object files to the source, we need to compute all the object files we want from our source files. I basically just prepend a $(BUILD_DIR)/ and append a .o to every source file path:
  • OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
    And then you can make your target depend on the objects files:

Automatic Generation of Include Directory Flags

I used a similar technique to generate include directory flags. Find all the directories under the given source directories:

  • INC_DIRS := $(shell find $(SRC_DIRS) -type d)
    And then prefix them with a -I:
  • INC_FLAGS := $(addprefix -I,$(INC_DIRS))

Hope those techniques are helpful for you.

-->

A makefile is a text file that contains instructions for how to compile and link (or build) a set of C++ source code files. A make program reads the makefile and invokes a compiler, linker and possibly other programs to make an executable file. Microsoft's implementation of the make program is called NMAKE.

If you have an existing makefile project, you have these choices if you want to code and/or debug it in the Visual Studio IDE:

  • Create a makefile project in Visual Studio that uses your existing makefile to configure a .vcxproj file that Visual Studio will use for IntelliSense. (You will not have all the IDE features that you get with a native MSBuild project.) See To create a makefile project below.
  • Use the Create New Project from Existing Code Files wizard to create a native MSBuild project from your source code. The original makefile will not be used after this. For more information, see How to: Create a C++ Project from Existing Code.
  • Visual Studio 2017 and later: Use the Open Folder feature to edit and build a makefile project as-is without any involvement of the MSBuild system. For more information, see Open Folder projects for C++.
  • Visual Studio 2019 and later: Create a UNIX makefile project for Linux.

To create a makefile project with the makefile project template

In Visual Studio 2017 and later, the Makefile project template is available when the C++ Desktop Development workload is installed.

Follow the wizard to specify the commands and environment used by your makefile. You can then use this project to build your code in Visual Studio.

By default, the makefile project displays no files in Solution Explorer. The makefile project specifies the build settings, which are reflected in the project's property page.

The redesigned and improved also Silent Mode is now integrated into the Network Monitor. Instead of answering each connection alert individually. Little snitch has not yet been registered list.

The output file that you specify in the project has no effect on the name that the build script generates; it declares only an intention. Your makefile still controls the build process and specifies the build targets.

To create a makefile project in Visual Studio 2019

Makefile Win Error In Dev C++

  1. From the Visual Studio main menu, choose File > New > Project and type 'makefile' into the search box. Or, in the New Project dialog box, expand Visual C++ > General (Visual Studio 2015) or Other (Visual Studio 2017) and then select from the two options depending on whether you will be targeting Windows or Linux.

  2. Windows only: In the Debug Configuration Settings page, provide the command, output, clean, and rebuild information for debug and retail builds. Click Next if you want to specify different settings for a Release configuration.

  3. Click Finish to close the dialog and open the newly created project in Solution Explorer.

To create a makefile project in Visual Studio 2015 or Visual Studio 2017

  1. From the Visual Studio start page, type 'makefile' in the New Project search box. Or, in the New Project dialog box, expand Visual C++ > General (Visual Studio 2015) or Other (Visual Studio 2017) and then select Makefile Project in the Templates pane to open the project wizard.

  2. In the Application Settings page, provide the command, output, clean, and rebuild information for debug and retail builds.

  3. Click Finish to close the wizard and open the newly created project in Solution Explorer.

Dev C++ Error 1073741674

You can view and edit the project's properties in its property page. See Set C++ compiler and build properties in Visual Studio for information about displaying the property page.

Makefile project wizard

After you create a makefile project, you can view and edit each of the following options in the Nmake page of the project's property page.

  • Build command line: Specifies the command line to run when the user selects Build from the Build menu. Displayed in the Build command line field on the Nmake page of the project's property page.

    Aug 27, 2009  Snow Leopard might crash your apps First of all, the new Boot Camp includes all the drivers necessary to run both the 32-bit and 64-bit versions of Windows 7 smoothly on the Mac hardware. May 17, 2017  For Mac users who also need to use a PC at work, home or just with specific applications, there is a solution. Using Boot Camp Assistant, you can install Windows 7 on your Intel-based Mac computer in its own partition. You’ll have a dual-boot system with your Mac OS on one partition and Windows on another. Mac os x snow leopard boot camp windows 7 download Nov 02, 2009  Question: Q: Snow Leopard Boot Camp and Windows 7 64bit I have a late 2006 Mac Pro with 2xDual Core 2.66ghz procs and 6 gigs of ram. I've been thinking of running Windows 7 64 bit in Boot Camp for a few games and had an EFI question.

  • Output: Specifies the name of the file that will contain the output for the command line. By default, this option is based on the project name. Displayed in the Output field on the Nmake page of the project's property page.

  • Clean commands: Specifies the command line to run when the user selects Clean from the Build menu. Displayed in the Clean command line field on the Nmake page of the project's property page.

  • Rebuild command line: Specifies the command line to run when the user selects Rebuild from the Build menu. Displayed in the Rebuild all command line field on the Nmake page of the project's property page.

How to: Enable IntelliSense for Makefile Projects

IntelliSense fails in makefile projects when certain project settings or compiler options are set up incorrectly. Follow these steps to configure makefile projects so that IntelliSense works as expected:

  1. Open the Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Expand the Configuration Properties node.

  3. Select the NMake property page, and then modify properties under IntelliSense as appropriate.

    • Set the Preprocessor Definitions property to define any preprocessor symbols in your makefile project. See /D (Preprocessor Definitions), for more information.

    • Set the Include Search Path property to specify the list of directories that the compiler will search to resolve file references that are passed to preprocessor directives in your makefile project. See /I (Additional Include Directories), for more information.

    • For projects that are built using CL.EXE from a Command Window, set the INCLUDE environment variable to specify directories that the compiler will search to resolve file references that are passed to preprocessor directives in your makefile project.

    • Set the Forced Includes property to specify which header files to process when building your makefile project. See /FI (Name Forced Include File), for more information.

    • Set the Assembly Search Path property to specify the list of directories that the compiler will search to resolve references to .NET assemblies in your project. See /AI (Specify Metadata Directories), for more information.

    • Set the Forced Using Assemblies property to specify which .NET assemblies to process when building your makefile project. See /FU (Name Forced #using File), for more information.

    • Set the Additional Options property to specify additional compiler switches to be used by IntelliSense when parsing C++ files.

  4. Click OK to close the property pages.

  5. Use the Save All command to save the modified project settings.

The next time you open your makefile project in the Visual Studio development environment, run the Clean Solution command and then the Build Solution command on your makefile project. IntelliSense should work properly in the IDE.

See also

Using IntelliSense
NMAKE Reference
How to: Create a C++ Project from Existing CodeSpecial Characters in a Makefile
Contents of a Makefile