awwit/httpserver

Error occurred when make

xiangpdu opened this issue · 4 comments

$ make
g++ -DPOSIX -std=c++14 -c -Wall -O2 src/socket/Socket.cpp -o build/obj/socket/Socket.o
In file included from /usr/include/x86_64-linux-gnu/bits/byteswap.h:35:0,
from /usr/include/endian.h:60,
from /usr/include/x86_64-linux-gnu/sys/types.h:216,
from src/socket/../system/System.h:30,
from src/socket/Socket.h:3,
from src/socket/Socket.cpp:2:
src/socket/Socket.cpp: In member function ‘bool Socket::Socket::bind(int) const’:
src/socket/Socket.cpp:108:6: error: expected id-expression before ‘(’ token
::htons(port),
^
make: *** [build/obj/socket/Socket.o] Error 1

Can you provide the description of you solution? "fixed issue #6" show nothing of the solution.

awwit commented

Of course

// GCC bug with global namespace: https://bbs.archlinux.org/viewtopic.php?id=53751
auto const net_port = htons(static_cast<uint16_t>(port));

If this fix should apply to all this functions like htons, htonl and so on?

awwit commented

Yes, it should help in such cases.
But only if macros are used instead of function names.
Not for all compilers and systems it is.