I have one *.cpp file but I cant it compile with MS VC++ ! How to compile signle .cpp file in VC++? Please help me!

Under "Build", click "Build Solution", or just hit F7.

If there is no "Build" in the menu, then you need to create a project first. Click File->New->Project.

You can work with a single file but it has to be in a project.
Why is that? You probably ask. Well you might add some other files later(resources, databasefiles, etc.) if you stay with one file OK, but it's handy if you have more files to keep them in one project.

Select the "File" menu and select "New Project...".
A window opens.
Under the many options select Console Application.

I created project but it shows:
->header files:
stdafx.h
targetver.h
->Source files:
stdafx.cpp
test2.cpp


Why so many files in project if I need compile 1 file and I dont need that files.. And I donkt know where to write my code in that stupid project..How can then I compile :(

After creating the Win32 Console Application project, there should be a window that says "Win32 Application Wizard". Click "next" and click the "Empty Project" checkbox.

3 years before I used Borland C++ compiler and their editor to and I didn't have to make new project to compile. I just opened I single Cpp file and click Compile and than Run and everything was OK . I'm interested to, to know how to compile a single .cpp file without making new project in Visual Studio probably it is possible.

This article has been dead for over six months. Start a new discussion instead.