# Pull CPP files (Online makecode.microbit.org)

**URL:** https://forum.makecode.com/t/pull-cpp-files-online-makecode-microbit-org/19532
**Category:** micro:bit extensions
**Created:** [May 1, 2023, 12:12am UTC](https://forum.makecode.com/t/pull-cpp-files-online-makecode-microbit-org/19532 "2023-05-01T00:12:41Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [May 4, 2023, 4:20pm UTC](https://forum.makecode.com/t/pull-cpp-files-online-makecode-microbit-org/19532/4 "2023-05-04T16:20:39Z")

</div>

> [@mwest226](#):
>
> I found the reason for the the cpp files not being pulled. I added the shim.d.ts and now the extension loads as expected. I am now having a problem with some errors.

Hi @mwest226,

I tried to create a fork and then “import” the fork (not add it as an extension, import the repo into MakeCode as a project). It didn’t work, which may mean there are still errors in the configuration. `shim.d.ts` should be automatically generated for you by the compile process. (Notice the “Auto-generated” comment in [this example](https://github.com/bsiever/microbit-pxt-i2cpins/blob/48d250ca05a461725269f6f8a66d2a3705318c77/shims.d.ts#L1))

I think the error may be partly due to the lack of actual typescript shims. Most extensions have both a .ts version of functions and a .cpp version. The .ts version is used in the simulator and to specify the API for TypeScript and the .cpp code is used in compiled/deployed projects.

I suspect you’ll need a .ts file in the project with something like:

```auto
//% color=#00FFFF 
//% icon="\ue0b7"
//% block="Flash Storage"
namespace flashstorage {
    //% blockId="getData" block="get data for %key|"
    //% shim=flashstorage::getData
    export function getData(key: string): string {
        // Per https://github.com/microsoft/pxt-microbit/issues/4292
        0;
        // The above will do nothing in the simulator, but your application could actually use TypeScript map for simulation purposes. 
    }
}

```

The i2c project I mentioned earlier is a pretty minimal example: [https://github.com/bsiever/microbit-pxt-i2cpins](https://github.com/bsiever/microbit-pxt-i2cpins) . The [i2crr.cpp](https://github.com/bsiever/microbit-pxt-i2cpins/blob/master/i2crr.cpp) has a corresponding [i2crr.ts](https://github.com/bsiever/microbit-pxt-i2cpins/blob/master/i2crr.ts) that declares the API for TypeScript. This includes things like block names, hints, tool box names, toolbox color, etc. It also designates the C++ function that should be used when running on the device.

---

_[View the full topic](https://forum.makecode.com/t/pull-cpp-files-online-makecode-microbit-org/19532)._
