I am trying to use secp256k1 for a toy project that I am working on for learning purposes. I am using Ubuntu 20.04 and I can clone and compile the library just fine. I have tried to include it in a simple hello world c file and I get the following error: secp256k1/src/num.h:19:2: error: #error "Please select num implementation" 19 | #error "Please select num implementation"

I have tried googling this but I can't seem to find anything (only https://github.com/breadwallet/breadwallet-ios/issues/60 but not sure how it applies to my situation). All I did was use this line #include "src/secp256k1.c" in my toy C code. I can't seem to find any documentation or walkthrough guide on simple usage of the library such as generating private keys and addresses (besides secp256k1.h). Any help would be appreciated!


See here for an example of a #define configuration. You may then search for those macros in the repo to see their alternatives and define the relevant ones before you #include "src/secp256k1.c"

I can't seem to find any documentation or walkthrough guide on simple usage of the library

This library is not meant for use as a single header, as explained in the README.md:

Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.")

The conventional way of using this library is compiling it and calling the linker when you compile your code with libsecp256k1.a for static linking (You may do gcc your-code.c libsecp256k1.a)

However, I used the library once with an #include only a long time ago, without any problems. That works, and as I described at the top, you just need a few #defines.

secp256k1.h is self-explanatory. You might want to read it all similarly to reading a story. Then you should be able to find the relevant functions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.