Build C++ code using cmd or powershell

Tanul 1,291 Reputation points
2020-09-11T19:39:09.467+00:00

Hello,

I'm not at all a c++ guy. After lot of effort I'm able to make a class library in basic c++ which return a hardcoded string. The code consist of a basic native unmanaged code and I cannot add mscorlib.

What is the list software or libraries should I install to build the code using cmd or powershell. I cannot install visual studio or c++ development kit.

I have checked on google and it is suggested to use gcc or visual c++ runtime. Can anyone suggest an old school technique or compiler for this. I need to make a batch script for an automated build to get a class library.

Thank you

Developer technologies C++
Developer technologies Visual Studio Other
Community Center Not monitored
0 comments No comments
{count} votes

Accepted answer
  1. Dylan Zhu-MSFT 6,426 Reputation points
    2020-09-14T03:32:03.367+00:00

    Hi @Tanul ,

    You could download the msbuild tool with C++ build tool workload
    24341-image.png

    And then, open developer command prompt for VS 2019, then type this command:
    msbuild [Your Project Name].vcxproj

    24361-image.png

    By the way, we suggest you could also read this document: Walkthrough: Compiling a Native C++ Program on the Command Line

    Best Regards,
    Dylan

    ---
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


3 additional answers

Sort by: Most helpful
  1. WayneAKing 4,931 Reputation points
    2020-09-11T20:51:24.56+00:00

    I don't know if MS has an install procedure that will allow installing just
    the command line tools, without installing Visual Studio. The device driver
    kits usually have the command line compiler, linker, etc.

    You can certainly use gcc without an IDE, but this is not the place to go
    into any details. For that you need to go to a forum that supports gcc.

    Another good choice for command line C++ development is the Embarcadero C++ compiler. It's free:

    https://www.embarcadero.com/free-tools/ccompiler

    • Wayne

  2. WayneAKing 4,931 Reputation points
    2020-09-11T21:00:00.843+00:00

    Also see:

    Using CMake with the free Embarcadero C++ compiler
    https://blogs.embarcadero.com/using-cmake-with-the-free-embarcadero-c-compiler/

    • Wayne
    0 comments No comments

  3. Daniel Xu 1 Reputation point
    2020-10-07T17:29:01.217+00:00

    You can set up a Linux subsystem in windows 10 and install GCC and MAKE in the Linux system.

    https://learn.microsoft.com/en-us/windows/wsl/install-win10

    The WSL 1 can assess both windows and Linux file systems. VS Code can have a remote terminal of the WSL, so you could compile and run in the vscode terminal directly without downloading large C++ compiler.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.