Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Fixed uWebSocket method signatures mismatch #3

Closed
wants to merge 1 commit into from

Conversation

bydavy
Copy link

@bydavy bydavy commented May 27, 2017

I can't compile the project on Ubuntu (what about other platforms?). The method signature for uWebsocket doesn't match the header file. I provided a fix which compile successfully on Ubuntu, can someone confirm it still compiles on Windows and Mac?

This was causing a compilation error on Ubuntu (and I assume all
other platfoms).
@bydavy
Copy link
Author

bydavy commented May 27, 2017

The compilation errors were against uWebSockets v0.14.3

@bydavy
Copy link
Author

bydavy commented May 27, 2017

Here are the compilation errors for reference:

cmake .. && make && ./mpc
-- Configuring done
-- Generating done
-- Build files have been written to: CarND-MPC-Project/build
[ 33%] Building CXX object CMakeFiles/mpc.dir/src/main.cpp.o
CarND-MPC-Project/src/main.cpp: In function ‘int main()’:
CarND-MPC-Project/src/main.cpp:151:4: error: no matching function for call to ‘uWS::Hub::onMessage(main()::<lambda(uWS::WebSocket, char*, size_t, uWS::OpCode)>)’
});
^
In file included from /usr/include/uWS/Hub.h:4:0,
from /usr/include/uWS/uWS.h:4,
from CarND-MPC-Project/src/main.cpp:2:
/usr/include/uWS/Group.h:69:10: note: candidate: void uWS::Group::onMessage(std::function<void(uWS::WebSocket, char, long unsigned int, uWS::OpCode)>) [with bool isServer = true]
void onMessage(std::function<void(WebSocket , char , size_t, OpCode)> handler);
^~~~~~~~~
/usr/include/uWS/Group.h:69:10: note: no known conversion for argument 1 from ‘main()::<lambda(uWS::WebSocket, char
, size_t, uWS::OpCode)>’ to ‘std::function<void(uWS::WebSocket
, char*, long unsigned int, uWS::OpCode)>’
/usr/include/uWS/Group.h:69:10: note: candidate: void uWS::Group::onMessage(std::function<void(uWS::WebSocket, char, long unsigned int, uWS::OpCode)>) [with bool isServer = false]
/usr/include/uWS/Group.h:69:10: note: no known conversion for argument 1 from ‘main()::<lambda(uWS::WebSocket, char*, size_t, uWS::OpCode)>’ to ‘std::function<void(uWS::WebSocket, char, long unsigned int, uWS::OpCode)>’
CarND-MPC-Project/src/main.cpp:169:4: error: no matching function for call to ‘uWS::Hub::onConnection(main()::<lambda(uWS::WebSocket, uWS::HttpRequest)>)’
});
^
In file included from /usr/include/uWS/Hub.h:4:0,
from /usr/include/uWS/uWS.h:4,
from CarND-MPC-Project/src/main.cpp:2:
/usr/include/uWS/Group.h:67:10: note: candidate: void uWS::Group::onConnection(std::function<void(uWS::WebSocket, uWS::HttpRequest)>) [with bool isServer = true]
void onConnection(std::function<void(WebSocket , HttpRequest)> handler);
^~~~~~~~~~~~
/usr/include/uWS/Group.h:67:10: note: no known conversion for argument 1 from ‘main()::<lambda(uWS::WebSocket, uWS::HttpRequest)>’ to ‘std::function<void(uWS::WebSocket
, uWS::HttpRequest)>’
/usr/include/uWS/Group.h:67:10: note: candidate: void uWS::Group::onConnection(std::function<void(uWS::WebSocket
, uWS::HttpRequest)>) [with bool isServer = false]
/usr/include/uWS/Group.h:67:10: note: no known conversion for argument 1 from ‘main()::<lambda(uWS::WebSocket, uWS::HttpRequest)>’ to ‘std::function<void(uWS::WebSocket, uWS::HttpRequest)>’
CarND-MPC-Project/src/main.cpp:175:4: error: no matching function for call to ‘uWS::Hub::onDisconnection(main()::<lambda(uWS::WebSocket, int, char
, size_t)>)’
});
^
In file included from /usr/include/uWS/Hub.h:4:0,
from /usr/include/uWS/uWS.h:4,
from CarND-MPC-Project/src/main.cpp:2:
/usr/include/uWS/Group.h:70:10: note: candidate: void uWS::Group::onDisconnection(std::function<void(uWS::WebSocket, int, char, long unsigned int)>) [with bool isServer = true]
void onDisconnection(std::function<void(WebSocket , int code, char message, size_t length)> handler);
^~~~~~~~~~~~~~~
/usr/include/uWS/Group.h:70:10: note: no known conversion for argument 1 from ‘main()::<lambda(uWS::WebSocket, int, char
, size_t)>’ to ‘std::function<void(uWS::WebSocket
, int, char*, long unsigned int)>’
/usr/include/uWS/Group.h:70:10: note: candidate: void uWS::Group::onDisconnection(std::function<void(uWS::WebSocket, int, char, long unsigned int)>) [with bool isServer = false]
/usr/include/uWS/Group.h:70:10: note: no known conversion for argument 1 from ‘main()::<lambda(uWS::WebSocket, int, char*, size_t)>’ to ‘std::function<void(uWS::WebSocket, int, char, long unsigned int)>’
CMakeFiles/mpc.dir/build.make:86: recipe for target 'CMakeFiles/mpc.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/mpc.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mpc.dir/all' failed
make[1]: *** [CMakeFiles/mpc.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@domluna
Copy link
Contributor

domluna commented May 27, 2017

@bydavy I'm guessing the install_ubuntu.sh script didn't work for you? It looks like signatures were changed in a recent version.

@bydavy
Copy link
Author

bydavy commented May 31, 2017

I tried uWebSockets v0.14.3 and install_ubuntu.sh (aka uWebSockets master) and I hit this error in both cases.

@domluna
Copy link
Contributor

domluna commented May 31, 2017

@bydavy an important part was commented out https://github.com/udacity/CarND-MPC-Project/blob/master/install-ubuntu.sh#L6. At that checkout the script should work.

@bydavy
Copy link
Author

bydavy commented Jun 1, 2017

I confirm this commit fixed my issue. uWebSockets has changed some method signatures "recently" and it was the reason of the failure. Pulling the given git hash will ensure to use the expected version of uWebSockets.

@bydavy bydavy closed this Jun 1, 2017
@bydavy
Copy link
Author

bydavy commented Jun 1, 2017

Thank you for the fix @domluna !

@TIEHua
Copy link

TIEHua commented Apr 25, 2018

fatal error: uWS/uWS.h: No such file or directory
I don't know why

2 similar comments
@TIEHua
Copy link

TIEHua commented Apr 25, 2018

fatal error: uWS/uWS.h: No such file or directory
I don't know why

@TIEHua
Copy link

TIEHua commented Apr 25, 2018

fatal error: uWS/uWS.h: No such file or directory
I don't know why

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants