Visual Studio Code C++ Cmake

  1. Vscode Cmake Build
  2. Visual Studio Code C Cmake 2017
  3. Visual Studio Code C++ Cmake Debug

Building with Visual Studio. We’ll generate a Visual Studio.sln file from the CMake command line. If you have several versions of Visual Studio installed, you’ll want to tell cmake which version to use. Again, assuming that the source folder is the parent: cmake -G 'Visual Studio 15 2017'. I use CMake to generate a Visual Studio 2010 project and solution file. Actually I could set different settings, like warning level, incremental building flag ect. But I can't set additional includes and libraries, listed in the VC Directory configuration tab. Actually I've to set up those directories manually. Compiling a debug version with CMake, NMake and VS Code. From the Visual Studio 2017 group, open a Developer Command Prompt. If you either select the Developer Command Prompt or the Native x86 Developer Command Prompt then the generated code will be 32 bits.

Open a codebase from any environment and get to work right away. Use MSBuild with the Microsoft Visual C compiler or a 3rd party toolset like CMake with Clang or mingw to build and debug your code right in the IDE. Benefit from a first-class CMake experience. Bring your C code to Visual Studio. Several command line tools can be found in the “Visual Studio 2019” directory of the start menu. We can open a command-line tool named “x64 native tools command prompt for vs 2019”. This icon corresponds to theC: Program Files (x86) Microsoft Visual Studio 2019 Community VC Auxiliary Build vcvars64.batThis script. The function of this script is to add the include path and library path of MSVC and windows SDK to environment variables, and then open a CMD command line.

in Propeller 1

Having trouble setting up PropWare with Visual Studio Code on a Windows 10 system(s)

The background is that a young sharp co-op student has been successfully producing propeller C/C++ code using Visual Studio Code for file generation and Propware from the command line to compile and download. We have been trying to get the same setup on my computer(s) following the guide on David Zemon's site using the information on the Getting Started page and the Download page (MS Windows section) but are unsuccessful in running cmake.

The PropWare is on the C drive (C:PropWare) as is the PropGCC (C:parallax). Attempted with SimpleIDE installed (C:Program Files (x86)SimpleIDE) and not installed.

The extensions (think should not influence command line operations?) installed in Visual Studio Code are:

The banner at the bottom of Visual Studio Code shows 'No Kit Selected'

The CMakeLists.txt file is as follows:

and the GettingStarted.cpp file is

Vscode Cmake Build

There are two error messages associated with the GettingStarted.cpp file:

but unsure if they relate to the cmake problem.

Upon running cmake the error message (with an empty Bin directory) is as follows

Visual Studio Code C++ Cmake

The CMake files in the bin directory are attached.

Visual Studio Code C++ Cmake

With the caveat that i am essentially ignorant of all matters IDE and compiling, a few items in CMakeCache stood out:

In looking around for hints on CMake_Make_Program program errors, common problems appear to be absence of a compiler or undefined tool path neither of which seem to be the problem and absence of or undefined path for nmake.exe. At some point in our trouble shooting i seem to recall an nmake.exe error but it has not recurred.

Unsure if there should be a value assigned after the ..:INTERNAL= statements or not.

Any advice or troubleshooting tips would be much appreciated.
Bruce Guest

Respectfully, @DavidZemon

txt
6K
log
96B
txt
449B
txt
5K
C++

Visual Studio Code C Cmake 2017

Comments

Visual Studio Code C++ Cmake Debug

  • Hi @bruceg! Great to hear someone still finds PropWare useful.
    The CMAKE_MAKE_PROGRAM variable defines the path to the middleman build system. You invoke CMake -> CMake generates Makefiles -> you invoke Make -> make invokes compiler/propeller-load/etc. There are multiple flavors of Make out there, so CMake needs to know what flavor you want to use so that it knows exactly how to generate the Makefiles.

    It appears that the PropWare documentation still says that GNU Make is included with the Windows distributable.. that's not true anymore. Hasn't been for a while. Sorry for the confusion. You'll need to pick a Make flavor yourself and get it installed and working. This has, for a long time, been the part that has given me the most trouble on Windows, and is no small part of why I gave up on actively maintaining PropWare (Windows users are the majority of users -> I don't like Windows -> Windows instructions are not as well tested -> majority of users find PropWare difficult to use -> I loose interest).

    You can try this installable - I've had luck with it in the past. But I've also seen that one fail to work. No idea if it will work for you today or not. Open source jit compiler. You could also try Ninja: https://github.com/ninja-build/ninja/releases. I remember doing some tests with it many years ago, and it worked fine, but it does prevent the 'debug' target from doing any good, so just be aware of that (Ninja tries to make your life 'easier' by hiding unnecessary compiler output, and the way PropWare is designed, Ninja doesn't know the difference between compiler output and propeller-load's/your program's output, so it all gets hidden). You could also try NMake - that's Microsoft's Make flavor. It comes bundled with full Visual Studio installations (not VSCode).

    There's a version of GNU Make included in the MinGW package. That's a complicated mess I haven't poked at in a long while, but it might work.

    And there's Cygwin. That should theoretically work quite nicely, since you just install Cygwin and then it has a package manager with the real version of GNU Make that you can install. I think I tested this some 7 or 8 years ago, but I don't remember at all whether or not it worked and if it did what (if any) issues I had to overcome. I would think it would work very well and very seamlessly, and that the only reason I don't recommend it in PropWare's documentation is because it runs contrary to my goal of making it as easy as Arduino (I don't like the idea that you should need to install Propware AND a compiler AND Cygwin AND Make).

    If you can integrate VSCode with WSL (Windows Subsystem for Linux), that is by far the easiest way to get compilation working. You just follow all of the Linux instructions and it works wonderfully. The only trick might be getting the serial port to work through the WSL layer so you can actually program the board.. I haven't tried it in years, and certainly not since WSL2 became a thing.

    Once you do have a flavor of Make installed, you'll need to make sure you pass the right string to CMake's -G flag. The 'Command-Line Build Tool Generators' section of this CMake docs page has the list of options available: https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#id9

    Let me know how it goes. I'd be happy to help some more and maybe we can find a proper solution to PropWare + Make on Windows.

    Cheers,
    David

  • @DavidZemon

    Thank you very much for your quick response, was just looking at the CMake-generator page pondering the depths of my ignorance when your post came through, so your explanation tied everything together perfectly. Went with GNU Make direct via the Make for Windows page and 'Setup program' package route. Other then having to manually put make on the Windows path it was straight forward. Will also give Cygwin a whirl on another machine and see how that goes and report back.

    Thank you for PropWare and thanks again for your help (i appreciate your lack of enthusiasm for Windows, will get to Linux one day..),
    Bruce

  • Excellent! Glad you got it working. If you run into any issues, feel free to let me know either here in the forums or in the issue tracker. Or if any of the open issues are directly affecting you, let me know and I can probably get it closed out.