visual c++ express 2010, anyone?

So my independent studies have lead me to this bad ass concept of a "makefile".
I hear it will glue different .cpp files together. So cool I'm totally excited! (I need a woman.) Any ways, for reasons I don't want to admit, I am stuck using visual c++ express 2010. Is there anyone who is really familiar with this IDE, that could explain how to make a basic makefile? When I start my IDE I can pick an option to create a makefile project. After giving my project a name, this project wizard pops up with many textfields, but I don't know what to fill out or what it wants me to do.

I basically want to know how to create the hello world program using 2 different .cpp files. I have these files ready to go, along with the header file. My research says these are done correctly. I just need the makefile to do its thing and get it all to compile. Any help?
Last edited on
You don't use makefiles in Visual Studio. You use a project file which is basically the same thing.

In very general terms:

- A "Project" is a group of one or more source (cpp) files and header (h/hpp) files.

- A "Solution" is a group of one or more projects.

As a beginner, you probably will only have 1 project per solution until you get into more advanced stuff.

Here's an outline to do this in visual studio. This makes it look a lot harder than it is... I'm just being very verbose here:

- Create a new project(I usually choose the "empty project" option from the wizard)

- You should have a side-bar that says "Solution Explorer". If you do not see it, go in the "View" menu and select "Solution Explorer" and it should make the window visible.

- The solution explorer is a tree view of all the files in your solution. Specifically, you should start out with a solution, and within that solution you should have 1 project (with the same name as the solution, usually), and within that project you'll have some folders... "Header Files", "Source Files", etc.

- Right click on one of the folders and say "Add New Item" and you can add additional cpp/h files to your project.

- Once you have one or more source files in the project, you can do a normal build and it will build all the cpp files.

Makefiles are conceptually similar, only you have to manually type out a configuration file (which basically involves learning an entirely separate scripting language) to specify what compiler to use, what options, which files, etc, etc. IDEs like Visual Studio basically automate all of that so you don't have to deal with it.
Visual Studio comes packaged with a program called NMAKE that you can use to build makefiles. It's very similar to GNU Make. It should be located in C:\Program Files (x86)\Microsoft Visual Studio\VC\bin\

I haven't used it much so I won't be of much help, but if you search MSDN for 'nmake' you should be able to find plenty of info.
NMAKE is usally only used for either legacy projects, which already have a makefile, or large scale projects where some or other tool which is incompatible with Visual Studio is being used by the build process (this was more common in the days before MSBuild came along.)

For normal-sized projects you would be far better using the .sln/.vcproj mechanism as that's what Visual Studio is geared up to use. For example, you can use the Project Properties dialog to config your build.

If you're keen enough (mad enough?) to use NMAKE , then see:

NMAKE Reference

Nmake Makefile Tutorial and Example


PS Note that the makefile dialect used by NMAKE is not the same as that used by Make (as used by GCC for Linux and MinGW.)

Edit: Thinking about it, the other place I've come across nmake makefiles is in open source, cross-platform projects, where they obviously don't want to go near Visual Studio.
Last edited on

Thank you Disch, you were right on. And thanks to others for some background info.

This case is now closed.
Topic archived. No new replies allowed.