# Workaround for using nuke_i license with Nuke Bridge in Katana on Windows

First of all, thanks to Foundry staff from [Katana Forums](https://community.foundry.com/discuss/topic/160631/having-trouble-configuring-nuke-bridge-with-a-nuke-i-license) for helping and providing a workaround!

As we can see from [Katana User Guide about Nuke Bridge](https://learn.foundry.com/katana/Content/ug/rendering_scene/katana-nuke-interop.html), we need to tell Katana to use nuke\_i (Nuke, NukeX or Nuke Studio) license instead of nuke\_r (Headless version of Nuke), if we don't have one or want to perform interactive comps.

---

# The Problem

According to the User Guide, you need to create an additional custom launcher script for nuke\_i license, then set it in KATANA\_NUKE\_EXECUTABLE.

On Windows, only **binary executables *(.exe)*** can be used as launchers at the moment. Otherwise, you'll get a message informed that it couldn't determine Nuke version from the launch script.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671814598720/007df40e-2b08-45e8-92de-d1af0dea5dfb.png align="center")

---

# Workaround

For a workaround, we need to create a ***binary executable (.exe)*** that acts as a launcher script. This will get a bit technical, but don't worry you can follow along!

---

## TLDR;

1. Download a **C++ compiler** (MSVC, MinGW, Clang, ...).
    
2. Create a new .cpp file and modify this code to your Nuke executable location.
    
    ```cpp
    #include <cstdlib>
    #include <string>
    #include <vector>
    
    int main(int argc, const char** argv)
    {
        std::vector<std::string> arguments;
        //Specify the location of Nuke executable.
        arguments.push_back("C:\\Path\\to\\Nuke.exe");
        //Specify the edition of Nuke to use.
        arguments.push_back("--nukex");
        //Specify the type of license to use.
        arguments.push_back("-i");
        for (int i = 1; i < argc; ++i)
            arguments.push_back(argv[i]);
    
        std::string command;
        for (const std::string& argument : arguments)
        {
            if (command.size())
                command += " ";
            command += "\"" + argument + "\"";
        }
        command = "\"" + command + "\"";
    
        return std::system(command.c_str());
    }
    ```
    
3. Compile the code to .exe with your compiler of choice.
    
4. Point KATANA\_NUKE\_EXECUTABLE in Katana launcher script to newly created .exe.
    
5. Launch Katana with the launcher script.
    

---

## Step-by-Step Guide

### 1\. Getting a compiler

To compile or create an executable file from the code you'll need **a compiler** for C++, in this guide I'll use **MinGW**. You can install MinGW via MSYS2, which you can download from [here](https://www.msys2.org/).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671816012134/4fe17394-49f1-46b8-bb03-b53cc7791213.gif align="center")

After the download is finished, **open the file** and simply go through the installation process.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671816205887/c12c8bc4-cec1-4ad9-adcb-9147dba61703.gif align="center")

Next, click on **Finish** to run MSYS2.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671816349755/9ca4956c-f545-4571-ba34-fb10f03a58f0.png align="center")

Now, you'll be greeted by the black window. To install MinGW copy the command from the box below and paste it into that window by pressing **Shift+Ins** or right-clicking and selecting **Paste**, then press **Enter** to execute the command.

```bash
pacman -S --needed mingw-w64-x86_64-gcc
```

Then, type **Y** and press **Enter** to start installing all the necessary tools. This will take about 400MB of your disk space.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671824385586/72ecc9d9-440a-475a-aa4d-66690e53b41a.png align="center")

After it finished, you'll see a screen that looks like this. Feel free to close it as we don't need it anymore.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671824435996/8a79ab68-f4f1-4762-a7d5-f7d2e87401c5.png align="center")

### 2\. Adding MinGW to Path Environment Variables

After installing MinGW, we'll need to add it to **Path** to be able to use it properly.

First, open the start menu and simply type **'env'** to search for **Edit the system environment variables**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671817782364/bed62aa3-c0f9-4a73-a751-51d48c61fc56.gif align="center")

Next, click on **"Environment Variables..."** button at the bottom of the window.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671826731010/8ccabe13-72ea-4092-8f40-3e204e117cf8.png align="center")

Double-click on **Path** to edit, then click on **"New"** button on the right and, type `C:\msys64\mingw64\bin` to add MinGW to Path. Then, click OK on every window to save.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671819146555/1544f5e9-2eed-445a-8d29-0fa64ba80014.gif align="center")

### 3\. Create a new C++ file

First, open Notepad or any other IDE of your choice, copy the code below and paste it in.

```cpp
#include <cstdlib>
#include <string>
#include <vector>

int main(int argc, const char** argv)
{
    std::vector<std::string> arguments;
    //Specify the location of Nuke executable.
    arguments.push_back("C:\\Path\\to\\Nuke.exe");
    //Specify the type of license to use.
    arguments.push_back("-i");
    for (int i = 1; i < argc; ++i)
        arguments.push_back(argv[i]);

    std::string command;
    for (const std::string& argument : arguments)
    {
        if (command.size())
            command += " ";
        command += "\"" + argument + "\"";
    }
    command = "\"" + command + "\"";

    return std::system(command.c_str());
}
```

Then, **modify the code** where it said `("C:\\Path\\to\\Nuke.exe");` to the location of your Nuke executable. Don't forget to change `\` to `\\` !

If you want to use **NukeX**, you can add a new line and type `arguments.push_back("--nukex");`, for **Nuke Indie** can type `arguments.push_back("--indie");` instead.

For example, my **Nuke 13.1v5** executable is `S:\Program Files\Nuke13.1v5\Nuke13.1.exe` and I want to use **NukeX** my code would look like this.

```cpp
#include <cstdlib>
#include <string>
#include <vector>

int main(int argc, const char** argv)
{
    std::vector<std::string> arguments;
    arguments.push_back("S:\\Program Files\\Nuke13.1v5\\Nuke13.1.exe");
    arguments.push_back("--nukex");
    arguments.push_back("-i");
    for (int i = 1; i < argc; ++i)
        arguments.push_back(argv[i]);

    std::string command;
    for (const std::string& argument : arguments)
    {
        if (command.size())
            command += " ";
        command += "\"" + argument + "\"";
    }
    command = "\"" + command + "\"";

    return std::system(command.c_str());
}
```

Next, save the modified code as .cpp file. In Notepad, you can Press Ctrl+S to save then change "Save as type:" to **All Files** and add **.cpp** to your file name.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671820811450/9efd9ba1-289d-4492-8d43-93c243e16d90.png align="center")

### 3\. Compile the code!

We are now close to the finish! To get the usable executable file we need to compile the code.

First, go to the location of the file saved in the previous step, right-click and select **Open in Terminal**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671821476089/06127bb9-e62c-4b77-a7ec-1f54e830cfa1.png align="center")

If Open in Terminal isn't available you can press **Shift and right-click** then select **Open PowerShell window here**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671821557903/f409ce5a-5d35-4793-a1cf-468a1379107e.png align="center")

Next, copy and modify the command below or type `g++` then space and type your .cpp **filename** with the **.cpp** extension, then space and type `-o` , then space again and type the **filename** you want with **.exe** extension.

```bash
g++ your_cpp_file.cpp -o your_exe_file.exe
```

*Use right-click to paste anything to Windows Terminal or PowerShell.*

For example, my file is named `launcher_for_katana_nuke_bridge.cpp` and I want my .exe file to name `launcher_for_knb.exe` the command will look like this.

```bash
g++ launcher_for_katana_nuke_bridge.cpp -o launcher_for_nkb.exe
```

Finally, press **Enter** and the executable file will be **created**!

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671822342191/fb58afa2-98da-47ce-98a1-8bf79c9ddacf.gif align="center")

### 4\. Tell Katana to use the new executable we created

We are now at the last step! Change **KATANA\_NUKE\_EXECUTABLE** to the executable we created.

*Before*

```bash
set KATANA_NUKE_EXECUTABLE=S:\Program Files\Nuke13.1v5\Nuke13.1.exe
```

*After*

```bash
set KATANA_NUKE_EXECUTABLE=C:\Users\VM\Documents\launcher_for_nkb.exe
```

***Finally,*** save and launch Katana with your launcher script. You should be able to use Nuke Bridge with nuke\_i license now!

---

# Resources

* [Katana User Guide about Nuke Bridge](https://learn.foundry.com/katana/Content/ug/rendering_scene/katana-nuke-interop.html)
    
* [A topic where I ask about the problem](https://community.foundry.com/discuss/topic/160631/having-trouble-configuring-nuke-bridge-with-a-nuke-i-license)
    
* [Nuke User Guide about Command Line Operations](https://learn.foundry.com/nuke/content/comp_environment/configuring_nuke/command_line_operations.html)
    
* [VSCode Documentation about Using GCC with MinGW](https://code.visualstudio.com/docs/cpp/config-mingw)
    

---

Please let me know if anything needs to be changed or if something is unclear.
