Tools, FAQ, Tutorials:
"cl" - Compile and Link C++ Program
How to use "cl" command tool to compile and link a C++ program?
✍: FYIcenter.com
If you want to compile and link a standard C++ program with "cl" command tool,
you can follow this tutorial:
1. Create a simple C++ program, Hello.cpp, with a text editor:
#include <iostream>
using namespace std;
void main() {
cout << "Hello, world, from Visual C++!" << endl;
}
2. Run "All Programs > Visual Studio 2017 > Visual Studio Tools > Developer Command Prompt for VS 2017". You see the Visual Studio Command Prompt window.
3. Compile and link the C++ program:
C:\fyicenter>cl Hello.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
Hello.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC
\14.10.25017\include\xlocale(314): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017
\include\exception(366): warning C4577: 'noexcept' used with no exception
handling mode specified; termination on exception is not guaranteed. Specify /EHsc
Microsoft (R) Incremental Linker Version 14.10.25019.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:Hello.exe
Hello.obj
4. Run the C++ program:
C:\fyicenter>Hello Hello, world, from Visual C++!
⇒ "link" - Link Object Files (*.obj)
⇐ "Hello.c" - Compile and Run C Program
2017-08-21, ∼3382🔥, 0💬
Popular Posts:
How to use the "send-one-way-request" Policy statement to call an extra web service for an Azure API...
FYIcenter.com Online Tools: FYIcenter JSON Validator and Formatter FYIcenter JSON to XML Converter F...
Where can I download the EPUB 2.0 sample book "The Metamorphosis" by Franz Kafka? You can following ...
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...
Where can I download the EPUB 2.0 sample book "The Problems of Philosophy" by Lewis Theme? You can f...