x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

LNK2019 errors when using Socket.IO classes.

So I'm attempting to link Socket.IO C++ Client to UE for connection purposes. I'm trying to follow these two setup guides https://github.com/socketio/socket.io-client-cpp (for socket.io) and https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System,

so far, when in the VS editor, the Socket.IO classes show up with no problem. Even autocomplete seems to work properly. As soon as I build, I encounter the following errors:

Error 2 error LNK2019: unresolved external symbol "public: __cdecl sio::client::client(void)" (??0client@sio@@QEAA@XZ) referenced in function "public: __cdecl ATest::ATest(class FObjectInitializer const &)" (??0ATest@@QEAA@AEBVFObjectInitializer@@@Z) C:\Users\User\Documents\Unreal Projects\Cards\Intermediate\ProjectFiles\Test.cpp.obj Cards

Error 3 error LNK2019: unresolved external symbol "public: __cdecl sio::client::~client(void)" (??1client@sio@@QEAA@XZ) referenced in function "public: __cdecl std::unique_ptr >::~unique_ptr >(void)" (??1?$unique_ptr@Vclient@sio@@U?$default_delete@Vclient@sio@@@std@@@std@@QEAA@XZ) C:\Users\User\Documents\Unreal Projects\Cards\Intermediate\ProjectFiles\Test.cpp.obj Cards

Error 4 error LNK2001: unresolved external symbol "public: __cdecl sio::client::~client(void)" (??1client@sio@@QEAA@XZ) C:\Users\User\Documents\Unreal Projects\Cards\Intermediate\ProjectFiles\Cards.generated.cpp.obj Cards

Error 5 error LNK2019: unresolved external symbol "public: class std::shared_ptr const & __cdecl sio::client::socket(class std::basic_string const &)" (?socket@client@sio@@QEAAAEBV?$shared_ptr@Vsocket@sio@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z) referenced in function "public: __cdecl ATest::ATest(class FObjectInitializer const &)" (??0ATest@@QEAA@AEBVFObjectInitializer@@@Z) C:\Users\User\Documents\Unreal Projects\Cards\Intermediate\ProjectFiles\Test.cpp.obj Cards

Error 6 error LNK1120: 3 unresolved externals C:\Users\User\Documents\Unreal Projects\Cards\Binaries\Win64\UE4Editor-Cards.dll Cards

Error 7 error : Failed to produce item: C:\Users\User\Documents\Unreal Projects\Cards\Binaries\Win64\UE4Editor-Cards.dll C:\Users\User\Documents\Unreal Projects\Cards\Intermediate\ProjectFiles\ERROR Cards

Error 8 error MSB3073: The command ""C:\Program Files\Unreal Engine\4.7\Engine\Build\BatchFiles\Build.bat" CardsEditor Win64 Development "C:\Users\User\Documents\Unreal Projects\Cards\Cards.uproject" -rocket" exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 Cards

I seem to be unable to access any of the sio::client class members. Does this mean I failed to link the library propery? Has anyone encountered a problem similar to this?

Product Version: Not Selected
Tags:
more ▼

asked May 08 '15 at 12:48 PM in C++ Programming

avatar image

JRavilo
36 2 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Update: I used another method to build the socket.io library(cmake then build solution : https://github.com/socketio/socket.io-client-cpp). I had to build boost(one of the Socket.IO dependencies) for 64-bit before building the actual Socket.IO C++ lib, again for 64-bit. I then used the same steps for linking it according to https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System and it seems to be working now.

more ▼

answered May 12 '15 at 03:32 AM

avatar image

JRavilo
36 2 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It means linker don't see .lib files of Socket.IO in order to link your code to library, you did something wrong in build script. Also you are aware that UE4 got it's own Socket API which you can use?

https://docs.unrealengine.com/latest/INT/API/Runtime/Sockets/FSocket/index.html

more ▼

answered May 08 '15 at 01:41 PM

avatar image

Shadowriver
37.2k 936 172 1116

avatar image JRavilo May 11 '15 at 03:21 AM

I see. I'm going to investigate if I can use FSocket client-side and Socket.IO server-side(is it possible?). Thanks for pointing this out.

avatar image Azarus May 11 '15 at 08:30 AM

FSocket is useful for networking UDP/TCP and other protocols.

Socket.IO uses Websockets or uses ajax if websocket is not avaliable. If you want to use FSocket you have to implement almost everything you need to use socket.io on server side.. I assume you want to use NopeJS, in this case i would recommend to keep going with c++ and Socket.IO.

Also the engine already has Websocket Support. https://answers.unrealengine.com/questions/98154/is-websocket-found-from-current-ue-4-libraries.html

avatar image Shadowriver May 12 '15 at 01:24 AM

Well i didn't know WebSocket has something more in to it, i just thouth is socket support for JS :p On link you gave it only said engine libwebsocket, but there no proper UE4 APIs made which would use HTTP module and FSocket to work with it. I think cleanest implementation in UE4 would be use of HTTP module and FSocket if that possible, or even extend classes that they provide to make it work, From what i read websockets is normal socket communication just under HTTP server supervision.

Also on an ote ajax is JS APIs thing which allows to do extra HTTP requests on background

avatar image Azarus May 12 '15 at 07:30 AM

The Socket.IO uses multiple protocols it is different than the standard web-socket, It's rather a wrapper. But all of them start with a single http request.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question