libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

incomplete type 'lws_context' ?

Open arnold0kang opened this issue 1 year ago • 3 comments

hi, I have cross compile the source code success, install OK , but get this error. how to resolve this? I have include libwebsockets.h

arnold0kang avatar Nov 12 '24 12:11 arnold0kang

It's always a good idea to paste the actual error. If it's in your code, you probably meant struct lws_context

lws-team avatar Nov 12 '24 12:11 lws-team

yes, a sample code, #include "libwebsockets.h" int main () { struct lws_context context_; } gcc error: error: field 'context_' has incomplete type 'lws_context'

arnold0kang avatar Nov 13 '24 03:11 arnold0kang

You can use -M with gcc to dump the paths of the include files used.

It sounds like you're including ./libwebsockets.h, or from some other path, which does not have the right stuff in. Eg, from some older lws or something completely different.

Normally, you use sudo make install or some variant of it to install the include tree (which has many files, not just libwebsockets.h). You can guide your gcc to the right place with -I to where you installed the right pieces.

lws-team avatar Nov 13 '24 07:11 lws-team