[Libwebsockets] libwebsockets.h build error with g++

Andy Green andy at warmcat.com
Wed Feb 28 10:55:28 CET 2018



On 28/02/18 17:17, Fredrik Skogman wrote:
> You are compiling C code with a C++ compiler. C and C++ are different 
> languages and you should not assume they are compatible.

You're not wrong, but no real reason it shouldn't work also with C++. 
If I had thought about it I would have expected the extern "C" to take 
care of it, but tbh I didn't think about it.

What version of lws are you using, OP?

jwk was only introduced on master, but this is fixed (by changing the 
name to _private) since at least before Nov 5th 2017.

If you're using master, always worth updating it to see if your problem 
is already solved.

-Andy

> Fredrik
> 
> Sent from my iPhone
> 
> On 28 Feb 2018, at 09:31, Chropin Hu <chropinhu at gmail.com 
> <mailto:chropinhu at gmail.com>> wrote:
> 
>> Dear All,
>>         I am developing a test program with c++.
>>         as following shows,
>> /#include <libwebsockets.h>/
>> /
>> /
>> /int main()/
>> /{/
>> /return 0;/
>> /}/
>>
>> but the compile output:
>>      g++ -D__GXX_EXPERIMENTAL_CXX0X__ -O0 -g3 -Wall -c 
>> -fmessage-length=0 -std=c++0x -MMD -MP -MF"main.d" -MT"main.o" -o 
>> "main.o" "../main.cpp"
>> In file included from ../main.cpp:9:0:
>> /usr/local/include/libwebsockets.h:1818:39: error: expected ‘,’ or 
>> ‘...’ before ‘private’
>>  lws_jwk_export(struct lws_jwk *s, int private, char *p, size_t len);
>>
>> I have checked the libwebsockets.h line 1818:
>> lws_jwk_export(struct lws_jwk *s, int private, char *p, size_t len);
>>
>> It`s seems that the funtion input param name comflct with c++ key word 
>> private.
>>
>> It`s a bug or am  i miss soming?
>>
>> Yours Chropin
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org 
>> <mailto:Libwebsockets at ml.libwebsockets.org>
>> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 



More information about the Libwebsockets mailing list