[Libwebsockets] /usr/local/include/libwebsockets.h:487:8: error: forward declaration of ‘struct libwebsocket’

Andy Green andy.green at linaro.org
Mon Sep 29 23:40:39 CEST 2014

On 30 Sep 2014 02:54, "satya gowtham kudupudi" <satyagowtham.k at gmail.com>
> Its fixed. Now I ran into below linker errors
> g++     -o dist/Debug/GNU-Linux-x86/ferrymediaserver
build/Debug/GNU-Linux-x86/WSServer.o build/Debug/GNU-Linux-x86/global.o
build/Debug/GNU-Linux-x86/main.o -L/usr/lib/i386-linux-gnu -lssl -lpthread
-lcrypto -lz -lbase -lwebsockets

I assume libwebsockets.so is installed somewhere in the default -L path,
like /usr/lib?

> build/Debug/GNU-Linux-x86/WSServer.o: In function
`WSServer::callback_http(libwebsocket_context*, libwebsocket*,
libwebsocket_callback_reasons, void*, void*, unsigned int)':
> /home/gowtham/Projects/ferrymediaserver/WSServer.cpp:179: undefined
reference to `libwebsockets_return_http_status'
> /home/gowtham/Projects/ferrymediaserver/WSServer.cpp:186: undefined
reference to `libwebsockets_return_http_status'
> /home/gowtham/Projects/ferrymediaserver/WSServer.cpp:265: undefined
reference to `libwebsockets_return_http_status'
> /home/gowtham/Projects/ferrymediaserver/WSServer.cpp:314: undefined
reference to `libwebsockets_return_http_status'

This comes out of server.c...

> /home/gowtham/Projects/ferrymediaserver/WSServer.cpp:350: undefined
reference to `libwebsocket_set_timeout'

... but this is built unconditionally.

I'm going to take a wild guess you might have an old build of the library
.so hidden away down /usr/local/lib that is getting linked in preference to
the latest one you built.

Try something like

find /usr -name "libwebsockets.so*"

to flush it out if so.  If that's not it, maybe C++ name decoration is
involved in making a mismatch, but the prototypes in the headers and the
definitions are the same.


> --
> Gowtham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20140930/a5e015c2/attachment-0001.html>

More information about the Libwebsockets mailing list