J
J
John Doe2018-07-28 14:19:04
C++ / C#
John Doe, 2018-07-28 14:19:04

Why can't I compile the example?

As an example, I took https://github.com/socketio/socket.io-client-cpp
I'm just trying to connect to the server, the server itself is available. What am I doing wrong?

#include "libs/socket.io-client-cpp/src/sio_client.h"

int main(int argc, const char * argv[]) {
    sio::client h;
    h.connect("http://127.0.0.1:3000");
    
    return 0;
}

Mistake:
Undefined symbols for architecture x86_64:
"sio::client::connect(std::__1::basic_string, std::__1::allocator > const&)", referenced from:
_main in main.o
"sio::client:: client()", referenced from:
_main in main.o
"sio::client::~client()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2018-07-28
@GavriKos

The library was not connected - that's why the linker swears. How to treat - put in the place where the linker is looking for libraries corresponding to the library (socket io), and the correct version, for your architecture.
Perhaps there is a library, but you need to change the architecture, for example, only x86 is included.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question