secp256k1 lib compiling issue "invalid use of incomplete type secp256k1_context" I make a small test code (test.cpp), try to show the problem I meet:
to compile use
g++ -o test test.cpp -lsecp256k1
#include &lt;stdio.h&gt;
#include &quot;secp256k1.h&quot;

static secp256k1_context_t *ctx = NULL;

int main(int argc, char **argv) {

ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN);
printf(&quot;Context created!\n&quot;);
secp256k1_context_t *ctx_clone;
ctx_clone = secp256k1_context_clone(ctx);
printf(&quot;Context cloned!\n&quot;);

/* if enable below two lines of code the compliling error will happen */
// secp256k1_ecmult_context_t* clone_ecm_ctx;
// secp256k1_ecmult_context_clone(clone_ecm_ctx, &amp;ctx-&gt;ecmult_ctx);

secp256k1_context_destroy(ctx_clone);
secp256k1_context_destroy(ctx);
printf(&quot;Context destroyed!\n&quot;);

return 0;
}

Without the two comments out code I will not have issue.
If with two comments out code, the complier will report that:
test.cpp:15:51: error: invalid use of incomplete type 'secp256k1_context_t {aka struct secp256k1_context_struct}'
 secp256k1_ecmult_context_clone(clone_ecm_ctx, &amp;ctx-&gt;ecmult_ctx);
                                                   ^~
In file included from test.cpp:2:0:
/usr/local/include/secp256k1.h:50:16: note: forward declaration of 'secp256k1_context_t {aka struct secp256k1_context_struct}'
 typedef struct secp256k1_context_struct secp256k1_context_t;
                ^~~~~~~~~~~~~~~~~~~~~~~~

That looks like I can not operate the context struct internal member (because of the opaque struct), however, my code indeed need to access the struct inside of the context struct, for exp, the below code will trig a similar compiling error:
secp256k1_ecdsa_sig_verify(&amp;ctx-&gt;ecmult_ctx, &amp;r1, &amp;s1, &amp;q, &amp;m)
is there any workaround there?
The reason for this error is that secp256k1_context is an opaque type. This means that you cannot create it on the stack; you need to create a heap-allocated version (and destroy it) using the functions from the API (specifically secp256k1_context_create and secp256k1_context_destroy, as Mark H mentioned in a comment). There is no way to access the internals.
You're right not to try to #include &lt;secp256k1.c&gt; ... aside from being unlikely to build and requiring you to bundle a copy of the whole library, it would expose internals of the library to your code which are not safe to use directly.
For what you are doing (replacing internal signing functionality with OCL-enabled versions) you are probably better off forking the library and directly editing the source. This isn't much more invasive than what you're trying to do, and it would let you use the existing unit tests and valgrind ctime tests to check your work.