Start by opening Visual Studio 2010 and clicking on File -> New Project. You should then see this dialog box:
Under "Visual C++", select "Win32 Console Application", choose a location (e.g. your desktop or a special folder somewhere dedicated to your projects), choose a project name, and click OK.
In this case, I chose the name "CSVMaker", because that's the name of the program that I am going to make in the next tutorial. It's highly recommended that you avoid using spaces in your project name. Note that the solution name will automatically change to match your project name - don't bother changing it.
Next, you will need to choose some application settings for your project. Click Next, and then you will see this window:
Make sure "Console application" is selected as the application type, and check the "Empty project" box. We don't want to start with any pre-existing code: we want to create our application from scratch because then we will know exactly what every line of code is for. Click Finish.
An empty project is worthless until you add some code to it! I recommend that you make sure your "Solution Explorer" window is always open at all stages of creating a program in Visual Studio, as it is commonly and easily used for adding/removing files, setting project properties, etc. If it's not open, you can always change which windows are visible in the View menu.
Right click your project and click Add -> New Item...:
Under "Visual C++", select a "C++ file (.cpp)". Notice how the file extension will be ".cpp" - this stands for C++ ("C plus plus"). These are the main coding files you will use in a C++ application.
Set the name of your new C++ file. Since this is where all of our code is going, I call it "main" (it will make more sense later). Then click Add:
Now you have an empty console application set up in Visual Studio 2010 with a starting code file called "main.cpp". You can finally start to write C++ code!
One last thing: it would be nice to be able to easily open your project folder. Fortunately, in VS there is a way of doing that. Right click your project in the Solution Explorer again, and click on "Open Folder in Windows Explorer":
Then a new explorer window should open, showing you the project folder's contents:
In this case, I probably have a few extra files/folders more than you. Don't worry, that doesn't mean you did something wrong. I have a "Debug" folder (and I could also have a "Release" folder) because I have already entered some code and run my program - this folder gets generated when you run a program in Debug mode (the default mode). I also have a folder called "input.txt" which I am using in my CSVMaker program.
Note that the folder Visual Studio opens is "CSVMaker/CSVMaker/". The project's solution file (with file extension ".sln" - in this case the file would be "CSVMaker.sln") is what you double click when you want to view/modify your program in Visual Studio, but it is found in just "CSVMaker/" (the parent folder of the one Visual Studio opens for you).
Hopefully this information has been helpful to you so that you can create and open a new, empty C++ console application in Visual Studio 2010.
No comments:
Post a Comment