Hablas otro idioma?

Saturday 26 January 2013

How to compile a C++ programme in Visual Studio 2010?

Not my tutorial but since it is in a video format, I thought was interesting to post it. It works and it is really well explained. Quite useful to me. Found it when I really needed it. Enjoy! Credits go to the author of the video tutorial.

Differences between compiling in MS Visual C++ 6.0 and compiling in MS Visual Studio 2010
Changes are often disturbing, specially regarding software usage. In reference to Visual Studio and more especifically regarding C++ compiling (which is the one I am familiarized with), the procedure was more straightforward in the 6.0 version to me. Unfortunately, I could not find the way to use it within a Win7 environment. In such version, the procedure was:
- Create a folder where the debugging and compiling will be carried out.
- Create your programme (and save it) and put all the input data for your programme inside the folder you just created.
-  Compile (Ctrl+F7) --> Yes (will be created a default workspace) (eventually, if a project with the name of your programme already exists such will be overwritten). In the case of MS VS 2010, the video-tutorial above indicates that a project has to be created at the beginning and the location of the project will be properly indicated. Later you should go to View --> open Solution Explorer (Ctl+Alt+L) if such did not open at the beginning --> Source files - right-click - add existing item, and open the code you wish to compile. Then go to Build --> Compile (Ctrl+F7).
- Notice that in the build window (on the bottom of your screen), will appear all errors and warnings that your code may contain. This contains very useful information which you will not be allowed to omit if you wish to compile your code. Thus, correct your code properly. In MS VS 2010, all errors and warnings will appear on the Output window (bottom of your screen). Correct all errors and solve you warnings if possible. On this version it is strange that the fopen function appears as a warning "unsafe function".
- Now Build your code (F7). Both the 6.0 and the 2010 versions.
- Execute the programme (Ctrl+F5). In the 2010 version, you should select Build --> Start Without Debugging option (also, Ctrl+F5). THE END.

How to run to cursor? (step by step debugging).
To me it is more comfortable to run to cursor when testing my code. In the MS VS 6.0 version, such option is found in  Build --> Start Debug --> Run to cursor (Ctrl+F10). In the MS VS 2010 version, place your cursor at the desired position, right-click and select Run to Cursor (Ctrl+F10).



 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...