uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

Installation And Your First Project

Product: 

Class: 

Guides you through installing the uCalc library and writing your first 'Hello, World!' expression.

Remarks

🚀 Installation and Your First Project

Welcome to uCalc! This guide will walk you through installing the library and writing your first line of code. Whether you prefer modern package managers or a manual setup, you'll be up and running in minutes.

1. Installation

We recommend using a package manager for the easiest setup, but manual installation is also fully supported.

The Easy Way: NuGet package manager

NuGet handles dependencies, toolchain integration, and updates automatically. If you are using Visual Studio, do the following:

  • From the menu, select Project > Manage NuGet Packages ...

  • If uCalc is still in pre-release, check-mark Include prerelease

  • Search for uCalcSoftware. For native C++, search for uCalcSoftware.Cpp

  • Install

  • For C++, simply add #include <uCalc.h> and you're ready to go.

  • For C#, simply add using uCalcSoftware; and you're ready to go.

  • For VB, simply add Imports uCalcSoftware and you're ready to go.

If you are on a non-Windows platform, or you are not using Visual Studio, then you can use NuGet commands, such as dotnet add package uCalcSoftware (for C++ it's uCalcSoftware.Cpp). If you are installing a prerelease, add --prerelease to the command.

C++ cmake

find_package(uCalc REQUIRED PATHS "./uCalc_SDK/cmake")target_link_libraries(TheirApp PRIVATE uCalc::uCalc)

The Manual Way: DLLs & Headers

If you prefer a manual setup, download
uCalc_SDK.2.1.3-preview.2.zip
or uCalc_SDK.2.1.3-preview.2.tar.gz
and unzip it. Find the header for your language:

uCalc.h is in uCalc_SDK\include\
uCalc.cs and uCalc.vb are in uCalc_SDK\wrappers\

Depending on your platform, find library files such as uCalc.dll, uCalc.lib, libuCalc.so, libuCalc.dylib in the following folders: linux-arm64, linux-x64, osx-universal, win-arm64, win-x64, or win-x86. and copy them to the appropriate locations for your platform. Then

  • For C++, simply add #include "uCalc.h" and you're ready to go.

  • For C#, simply add using uCalcSoftware; and you're ready to go.

  • For VB, simply add Imports uCalcSoftware and you're ready to go.

follow the steps for your platform and language.

2. Your First Project: "Hello, uCalc!"

Let's evaluate a simple math expression. This example uses the modern, simplified syntax for creating and evaluating expressions.

The core object is the uCalc.Expression. Thanks to uCalc's built-in shortcuts, you can treat it much like a native variable, assigning new formulas as strings and retrieving results just as easily. For more details, see the Shortcut notations topic.

The following code creates an expression, reassigns it a new formula, and prints the result to the console.

Examples

A 'Hello, World!' example demonstrating the creation and evaluation of an expression using the modern, simplified syntax.
				
					using uCalcSoftware;

var uc = new uCalc();
// Create a new Expression object with an initial formula.
// This uses the default uCalc instance for context.
var expr = new uCalc.Expression("1 + 1");

// Implicitly calls .EvaluateStr() when used in a string context
Console.WriteLine($"Initial value: {expr}");

// Reassign the expression to a new formula with a simple string assignment.
// This implicitly calls .Parse() behind the scenes.
expr = "10 * (5 + 3)";

// Retrieve the result. For numeric results, you can assign it
// directly to a double. This implicitly calls .Evaluate().
double result = expr;
Console.Write("New value: "); Console.Write(result);
				
			
Initial value: 2
New value: 80
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Create a new Expression object with an initial formula.
   // This uses the default uCalc instance for context.
   uCalc::Expression expr("1 + 1");

   // Implicitly calls .EvaluateStr() when used in a string context
   cout << "Initial value: " << expr << endl;

   // Reassign the expression to a new formula with a simple string assignment.
   // This implicitly calls .Parse() behind the scenes.
   expr = "10 * (5 + 3)";

   // Retrieve the result. For numeric results, you can assign it
   // directly to a double. This implicitly calls .Evaluate().
   double result = expr;
   cout << "New value: " << result;
}
				
			
Initial value: 2
New value: 80
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Create a new Expression object with an initial formula.
      '// This uses the default uCalc instance for context.
      Dim expr As New uCalc.Expression("1 + 1")
      
      '// Implicitly calls .EvaluateStr() when used in a string context
      Console.WriteLine($"Initial value: {expr}")
      
      '// Reassign the expression to a new formula with a simple string assignment.
      '// This implicitly calls .Parse() behind the scenes.
      expr = "10 * (5 + 3)"
      
      '// Retrieve the result. For numeric results, you can assign it
      '// directly to a double. This implicitly calls .Evaluate().
      Dim result As Double = expr
      Console.Write("New value: ")
      Console.Write(result)
   End Sub
End Module
				
			
Initial value: 2
New value: 80