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
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)?
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.
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.