How to compile a program from the visual studio console

0

Hello my question basically is if I have a file for example main.cpp it is possible to compile it from the console with the compiler and if that is how it would be since opening and closing visual studio is sometimes a bit slow. So that's basically when the console I mean: System symbol for VS2013 developers. I was looking but I do not give with the key yet.

  

The example would be a main.cpp, compile it with the compiler from   console ..

    
asked by Perl 17.11.2016 в 19:26
source

1 answer

3

The answer is in the documentation: link

Example hello.cpp:

#include <iostream>  
using namespace std;  
void main()  
{  
    cout << "Hello, world, from Visual C++!" << endl;  
}  

Compile with the following command:

c:\"tu directorio">cl /EHsc hello.cpp  
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23918 for x86  
Copyright (C) Microsoft Corporation.  All rights reserved.  

hello.cpp  
Microsoft (R) Incremental Linker Version 14.00.23918.0  
Copyright (C) Microsoft Corporation.  All rights reserved.  

/out:hello.exe  
hello.obj  

Run:

c:\"tu directorio">hello.exe

Exit:

Hello, world, from Visual C++! 
    
answered by 17.11.2016 в 19:31