Closed dblarons closed 7 years ago
Hi @dblarons, thanks for your contributions!
Got below error whiel running c++ code:
int main() { uWS::Hub h;
h.onMessage([](uWS::WebSocket<uWS::SERVER> *ws, char *message, size_t length, uWS::OpCode opCode) {
ws->send(message, length, opCode);
});
if (h.listen(3000)) {
h.run();
}
}
$ g++ -std=c++11 -std=gnu++11 uw_ex2.cpp
ERROR:
/tmp/cc6sXr4A.o: In function uWS::Hub::Hub(int, bool, unsigned int)': uw_ex2.cpp:(.text._ZN3uWS3HubC2Eibj[_ZN3uWS3HubC5Eibj]+0x36): undefined reference to
uS::Node::Node(int, int, i
nt, bool)'
uw_ex2.cpp:(.text._ZN3uWS3HubC2Eibj[_ZN3uWS3HubC5Eibj]+0x5a): undefined reference to uWS::Group<true>::Group(in t, unsigned int, uWS::Hub*, uS::NodeData*)' uw_ex2.cpp:(.text._ZN3uWS3HubC2Eibj[_ZN3uWS3HubC5Eibj]+0x86): undefined reference to
uWS::GroupuS::Node::~Node()' /tmp/cc6sXr4A.o: In function
uWS::Hub::~Hub()':
uw_ex2.cpp:(.text._ZN3uWS3HubD2Ev[_ZN3uWS3HubD5Ev]+0x1a): undefined reference to inflateEnd' uw_ex2.cpp:(.text._ZN3uWS3HubD2Ev[_ZN3uWS3HubD5Ev]+0x7d): undefined reference to
uS::Node::~Node()'
collect2: error: ld returned 1 exit status
OS: macOS Sierra
I already have Xcode and Xcode developer tools installed.
As per the README, I installed ghostscript with brew and set the
GS4JS_HOME
environment variable.When I
yarn install --force
, I get the following error:It appears that the C++ 11 headers could not be found (mutex.h), so I specified them in the
binding.gyp
file.uWebSockets
had a related issue withnode-gyp
, and their solution was what worked for me. The comment is at the bottom (couldn't link to it directly). https://github.com/uNetworking/uWebSockets/issues/93