# Can't recognise khpun, khp functions...

**URL:** <https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [July 18, 2023, 7:47am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940 "2023-07-18T07:47:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 18, 2023, 7:47am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/1 "2023-07-18T07:47:00Z")

</div>

I’m using the new kdb package which downlaod from Github(https://github.co/KxSystems/kdb), it has the C API interface to convert data into K type.

While I write code in Visual Studio and try to compile it, there’re error message. Such as: can’t recognize khpun, khp function.

So I must made&nbsp;

---

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 18, 2023, 7:56am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/2 "2023-07-18T07:56:00Z")

</div>

So I must made mistake. May I ask any advice that I can follow to check? Or are there special setting for Visual Studio(such as set lib, dll file path)?

---

<div class="post-metadata">

**Author:** ![davidcrossey1](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@davidcrossey1](https://forum.kx.com/u/davidcrossey1)\
**Post date:** [July 18, 2023, 8:22am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/3 "2023-07-18T08:22:00Z")

</div>

Have you included the k.h header file in your code?&nbsp;

There is a good whitepaper from &nbsp;using the capi you can follow here

---

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 18, 2023, 8:28am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/4 "2023-07-18T08:28:00Z")

</div>

Thanks davidcrossey. I had included the k.h in my cpp file.

It seems khpun function in k.h can’t be invoked.&nbsp;

---

<div class="post-metadata">

**Author:** ![davidcrossey1](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@davidcrossey1](https://forum.kx.com/u/davidcrossey1)\
**Post date:** [July 18, 2023, 12:57pm UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/5 "2023-07-18T12:57:00Z")

</div>

Did you compile your code and link against the c.o object file too? Check out&nbsp;kdb/l64/c.o at master · KxSystems/kdb · GitHub&nbsp;If you need a different OS binary, check out the directories at the root of the repo.

More info here:&nbsp;C/C++ | Interfaces | kdb+ and q documentation - Kdb+ and q documentation (kx.com)

---

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 18, 2023, 2:40pm UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/6 "2023-07-18T14:40:00Z")

</div>

Thanks,&nbsp;My OS is Win10 64bit.

I’m reading the doc(https://code.kx.com/q/wp/capi/#creating-a-simple-list-object) and want to copy sample code into my Visual Studio env. But why I can’t find the “common.h” file?&nbsp;

---

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 18, 2023, 2:45pm UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/7 "2023-07-18T14:45:00Z")

</div>

OK, I found it(https://github.com/kxcontrib/capi).

---

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 18, 2023, 3:45pm UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/8 "2023-07-18T15:45:00Z")

</div>

I did test based on the source code from Github, for example the portopen.c, common.h, k.h

But error message reports at my Visual Studio env:&nbsp;E0167 “const char \*”&nbsp; &nbsp;“S”&nbsp;

Does the k.h works fine at Win10 64bit env?

---

<div class="post-metadata">

**Author:** ![davidcrossey1](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@davidcrossey1](https://forum.kx.com/u/davidcrossey1)\
**Post date:** [July 19, 2023, 2:13am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/9 "2023-07-19T02:13:00Z")

</div>

Yes it can be used on w64, however there are differences in terms of the libraries needed for linking:&nbsp;kdb/w64 at master · KxSystems/kdb (github.com)

This repo:&nbsp;kxcontrib/capi (github.com)&nbsp;only supports Linux based environments. You could fork it and add Windows support yourself, or a more straight forward solution would be to setup WSL2 with a \*nix distribution (such as Ubuntu), and use that environment for your local development - works with VS Code.

---

<div class="post-metadata">

**Author:** ![hzadonis3691](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hzadonis3691](https://forum.kx.com/u/hzadonis3691)\
**Post date:** [July 19, 2023, 7:06am UTC](https://forum.kx.com/t/cant-recognise-khpun-khp-functions/12940/10 "2023-07-19T07:06:00Z")

</div>

It took me 2 days but still failed. I have to use the old version(the old k.h and c.obj) with the same code I wrote, it works fine. So I doubt there’re bug or something I don’t know that caused the issue.
