Skip to content
Icho edited this page May 21, 2024 · 5 revisions

How to setup NStrings using Visual Studio

image

This set up tutorial is specifically for Visual Studio. if you are using a Different IDE search "How to consume a static library in [Your IDE Here]"

There are two methods to adding NStrings to your project, if one doesn't work try the other, if they both don't work make a issue and I can assist😸

Pros and Cons of each method

Method # Pro Con
Method 1 Faster and more concise Requires manual upgrading
Method 2 Will automatically update if you replace the .h and .lib while keeping names and locations the same Can be seen as confusing or harder to do

Method 1: Adding the .lib as a file in the solution

Step 1: Download the latest release of Nstrings

You can download older versions if you'd like but this walkthrough is meant for setting up v0.1.0-Beta and onward All versions older than v0.1.0-beta have been deprecated as of 24/5/24

Step 2: Unzip and organize

Unzip the release package downloaded from step one. While the place you save it doesn't particularly matter it is recommend that its folder is in the same directory as your project folder.

image

(In the image both directories are in ..\Desktop\Demo)

Step 3: Open your project

Or start a new one. The process is the same either way.

Step 4: Add "NString_Static.lib" to the project

To do this right click the top node of your project in your solution explorer and under "Add" click "Existing Item" (Shown Below) image

Then in the file window navigate to the directory that contains NString_Static.lib and click "Add" image

Step 5: Include NString.h

This step will vary depending on how you set up your directories but using the setup shown in step 2 the line to include the .h file will be

#include "..\NStrings\nstring.h"

Method 2: Adding NStrings as an additional dependency

Step 1: Download the latest release of Nstrings

You can download older versions if you'd like but this walkthrough is meant for setting up v0.1.0-Beta and onward All versions older than v0.1.0-beta have been deprecated as of 24/5/24

Step 2: Unzip and organize

Unzip the release package downloaded from step one. While the place you save it doesn't particularly matter it is recommend that its folder is in the same directory as your project folder.

image

(In the image both directories are in ..\Desktop\Demo) While this is not all that necessary for this method of installation it still makes it helpful

Step 3: Open your project

Or start a new one. The process is the same either way.

Step 4: Open your project properties

You can do this by hitting Alt+Enter or right clicking on the top node of your solution and clicking properties.

image

Step 5: Navigate to "Additional Dependencies"

To do this go to the "Linker" tab on the left side menu and select "Input"

image

Step 6: Add NString_Static.lib to "Additional Dependencies"

In the large box on the right locate the line named "Additional Dependencies" which should be at the top and look like the attached image

image

At the front of the list in the right most field add the file path to NString_Static.lib followed by a semi-colon

This Step will vary depending on where you save NStrings, the file path in the image would work given the example in step 2

image

Step 7: Include NString.h

This step will vary depending on how you set up your directories but using the setup shown in step 2 the line to include the .h file will be

#include "..\NStrings\nstring.h"

Now you can use nstrings in your project! 😸