Friday, November 25, 2011

Compiling a Native C++ Program from Command Line (C++)

1.Run Visual Studio 2008 Command Prompt window with Administrator privileges.
2.Set the following directory as the current directory at the command prompt: \Program Files\Microsoft Visual Studio <version>\VC.
3.In command prompt, type notepad sample.cpp and press Enter.

Click Yes when you are prompted to create a new file.
4. Type following code in notepad

#include <iostream>

int main()
{
std::cout << "This is a sample C++ program." << std::endl;
return 0;
}

5.On the File menu, click Save. You have created a Visual C++ source file.



6.In command prompt, type cl /EHsc sample.cpp and press Enter. The /EHsc command-line option instructs the compiler to enable C++ exception handling

7.The cl.exe compiler generates an executable program sample.exe.The .obj file is an intermediate format file.

8.To run the sample.exe program, type simple and press Enter.

No comments:

Post a Comment

How to enable CORS in Laravel 5

https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...