Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Visual Studio Code and Ultra App Kit on Windows


Before doing anything I want to use Visual Studio Code in Windows instead of Visual Studio. The reason is that I'm already using Visual Studio Code for some other things and really like it and don't feel that installing Visual Studio just for compiling my Ultra App Kit development is something that I want to do. I got that working and will here describe how I did that. Maybe there's better ways, just give suggestions in that case. Anyway here we go then.

I assume that you have he Ultra App Kit and Visual Studio Code installed already (no need for anything else at first)

Installing C++ support in Visual Studio Code

Open Visual Studio Code, press Ctrl+Shif+X. This will bring upp available extensions. Type C++ in the search box and install C/C++ by Microsoft.

image.png.83cb68915df4a6d068af046bfb536444.png

 

Installing Build Tools for Visual Studio 2019

Next thing is to install the Build Tools needed. Head over to Microsoft Visual Studio Downloads, scroll down and download the Build Tools and install them. No Visual Studio needed.
 

image.thumb.png.dc750f341ac3e0b1a6419f6d2ebf8d36.png

 

Create your Ultra Kit App

Create an Ultra Kit App. In my case I created a 'DrawBuddy' app. Then open Visual Studio Code and type Ctrl+K Ctrl+O to select the created app folder.

image.thumb.png.d97257585ac93242e373fc32b9fec288.png

 

Next select 'File' and 'Save Workspace As'. I'm using the same name as the app for the workspace. You can name anything you want.

image.thumb.png.55f0a203f6f29736abff3a87a50daafd.png

 

Hiding files that's of no interest for the project

You will find a lot of files in the explorer that are of no interest for creating code and compiling.

image.thumb.png.71c212988a60862674375d0058c67f2f.png

Personally I hide those files as I find that they just clutter up things. Such files are DLL's, Mac and Linux things and some other stuff. To hide those things open the file called 'DrawBuddy.code-workspace' in the editor and add following directly below the "files.associations" block (don't forget a comma)

"files.exclude": {
            "**/.vs/": true,
            "**/*.dll": true,
            "**/*.dylib": true,
            "**/*.entitlements": true,
            "**/*.ilk": true,
            "**/*.mm": true,
            "**/*.obj": true,
            "**/*.pdb": true,
            "**/*.props": true,
            "**/*.sln": true,
            "**/*.so": true,
            "**/*.vcx*": true,
            "**/*.xc*": true,
            "**/*.xcode*": true,
            "**/*.xib": true,
            "**/Info.*": true,
            "**/makefile": true,
            "**/Plugins/": true,
            "**/x64/": true,
            "**/x86/": true,
            "**/AppDelegate.h": true
        }

After doing that you will get a more clear view on the files to bother about. 

image.png.c25a9afc9b2b381ef85af3d6cba761c6.png

 

Adding support for building the project

In order to compile and link we need to add some json files to the project. To make life easy I have provide them here:

tasks.json 
Compiling and linking. 

Depending on you installation you may have to change the CL.EXE path in this line

"command": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe",

By default the resulting executable is created in the project folder with the same name as the project folder. If you project is in MyProject, the executable will get the name MyProject.exe. You may change this to whatever you want by editing the line 

// Executable
"/out:${workspaceFolder}/${workspaceFolderBasename}.exe",

launch.json
Debugging and runnning.
If you have changed the name of the executable in tasks.json you need to change this line also

 "program": "${workspaceFolder}\\${workspaceFolderBasename}.exe",

c_cpp_properties.json
Some general settings for C++ development

Here you may have to change the version number of the Windows SDK

"windowsSdkVersion": "10.0.19041.0",

 

Build project 

In order to compile and link you just have to press Ctrl+Shift+B at anytime and you will get a popup where you can select what to compile.

image.png.6f2a6102f814afe014a906da83f7a169.png

The last alternative 'detected task' I haven't bothered setting up, so select either 'Build Debug' or 'Build Release'. If you need to add support for just compiling current source file the detected alternative is you choice, however then you must set it up in the tasks.json more or less in the same way as for the other alternatives.

You will get the compiler output in a terminal windows like this

image.thumb.png.0704649f29da3422cda92007b4381d65.png

 

Debugging

Debugging is easy. Just set your breakpoints and press F5

image.thumb.png.23799edf25bdc29064c6c84f14bcace4.png

 

Hope this was helpful.

 

tasks.json c_cpp_properties.json launch.json

 

image.png

  • Like 3

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...