- Download and install Visual Studio 2013 (Express or the version you like) from the Microsoft website (it's free to try), preferably the latest Visual Studio you can find (such as VS2019--ie. not VS2013). I recommend downloading it in English because all the references on the internet and here are mostly in English.
- After installing, a menu will let you choose Visual C++ as your default setting. *
- A folder will be needed where our development solutions will be placed, which I often call "Dev" because it's short and straightforward.
- You can then create a new solution and project as follows:
-- Open Visual Studio 2013
-- Go to menu File -> New -> Project.
-- Select Visual C++ -> Win32 -> Win32 Console Application
-- Type the name of the project and the name of the folder in the "Location" box, then click on OK. Another window will show more options.
-- Select "Application Settings" and check the Empty Project checkbox.
-- Click on Finish and the project and project files will be created.
After that you will be able to add files to this new project from the samples you find here or browsing the web. If you want to test you can write a hello world as follows:
- Right click on the project name in the Solution Explorer in Visual Studio (at the right or left of the edit area)
- Select Add -> New item
- Select Visual C++ -> C++ file (.cpp)
- Type the name of the file, such as "main.cpp" at the name box.
- Click on "Add" to create the file.
- Then type the following code into the main.cpp file:
#include <stdio.h>
void main()
{
printf("Hello world!\n");
}
- Press F7 (or ctrl+shift+b if you didn't set up Visual C++ settings) to build the executable and F5 to execute in debug mode. Press Ctrl+F5 to execute without closing the console window after execution so you can see the program output.
For starting coding in your new project, you can continue reading the next tutorial which explains the basic structure of a C/C++ program.
* If you didn't set up Visual C++ settings during install you can do it later by going to menu tools -> import and export settings -> reset all settings and the option will appear again.
No hay comentarios:
Publicar un comentario