[Libwebsockets] Compilation error

Andy Green andy at warmcat.com
Thu Jul 22 06:19:08 CEST 2021



On 7/21/21 9:46 PM, loic nicolas wrote:
> Good evening,
> 
> I get this error when I try to run one of the examples:
> 
> |1> main.obj: error LNK2001: unresolved external symbol 
> _lws_retry_sul_schedule_retry_wsi 1> main.obj: error LNK2001: unresolved 
> external symbol _lws_retry_sul_schedule 1> main.obj: error LNK2001: 
> unresolved external symbol _lws_get_context 1> main.obj: error LNK2001: 
> unresolved external symbol _lws_extension_callback_pm_deflate 1> 
> main.obj: error LNK2001: unresolved external symbol _lws_strncpy 1> 
> main.obj: error LNK2001: unresolved external symbol 
> _lws_callback_http_dummy 1> main.obj: error LNK2001: unresolved external 
> symbol _lws_service 1> main.obj: error LNK2001: unresolved external 
> symbol _lws_sul_schedule 1> main.obj: error LNK2001: unresolved external 
> symbol __lws_log 1> main.obj: error LNK2001: unresolved external symbol 
> _lws_sul_cancel 1> main.obj: error LNK2001: unresolved external symbol 
> _lws_context_destroy 1> main.obj: error LNK2001: unresolved external 
> symbol _lws_create_context 1> main.obj: error LNK2001: unresolved 
> external symbol _lws_cmdline_option_handle_builtin 1> main.obj: error 
> LNK2001: unresolved external symbol _lws_json_simple_find |
> 
> I compiled the library using visual studio 2019 and i have link 
> websockets.lib
> How to deal with this problem please?

You seem to be building something and not linking the libwebsockets 
library binary to it.

If you just want to build the examples, you can build all that apply to 
your library build options with -DLWS_WITH_MINIMAL_EXAMPLES=1 when you 
build the library.

Otherwise use vc to tell it to also link to lws library.

-Andy



More information about the Libwebsockets mailing list