Can't recognise khpun, khp functions...

https://learninghub.kx.com/forums/topic/cant-recognise-khpun-khp-functions

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.

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

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

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

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

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

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

Thanks, 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?

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: E0167 “const char *” “S”

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

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

This repo: kxcontrib/capi (github.com) 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.