views:

62

answers:

3

I'm a .net developer by heart and usually write web applications. However I've been given the binary of a small project and I need to compile it (I think).

It is only two files: mfile.h and mfile.cpp. From looking at the code the .h file is a header file that contains constants and the cpp file is the actual codefile.

I created a new C++ makefile project in Visual Studio Pro 2008 and added these but when I try to build it just says Error 1 Error result -1 returned from ''. Project mfile

I honestly have never worked with this type of code before but I want to compile this and start learning. What exactly am I missing?

+1  A: 

Do not create a makefile project but a standard Console application project (empty). After the empty project is created, add the two files and hit F5. If there are no errors or missing dependencies, everything should compile and run.

dark_charlie
If I make it a Console App, does the console stay up the entire time?
drpcken
A: 

Using the makefile project is not the right approach (for windows at least). You should start by using the wizard for a new C++ project. Add those files to the created solution and build.

David
+2  A: 

Wish you were running VS 6, in which case you'd just load the .cpp file, click "build", click "okay" when it says it's going to create a project for you, and off you go.

With VS 2008, you want to:

  1. Move these files into a directory by themselves
  2. Select File -> New -> Project from Existing code...
  3. Accept "Visual C++ Project"
  4. Select the directory where you put the file
  5. Probably select "Console Application Project"
  6. Accept the rest of the defaults (click "Finish").

Now you should be able to (finally) build your project.

Alternatively, you can compile from the command line. In the start menu go to "Microsoft Visual Studio 8.0" -> "Visual Studio Tools" and pick one of the command prompts. When it opens, use cd to switch to wherever you've stored the files. Type:

cl mfile.cpp

to compile.

Jerry Coffin