-
Notifications
You must be signed in to change notification settings - Fork 744
Description
Hello,
I've followed the set up instructions as best as I can, boost seems linked, as well as the socket-io libraries. Following the example my main.cpp looks like this:
#include "./lib/socket.io-client-cpp/src/sio_client.h"
#include "./lib/socket.io-client-cpp/src/sio_socket.h"
#include "./lib/socket.io-client-cpp/src/sio_message.h"
int main(int , char* argv[]) {
sio::client h;
h.connect("http://127.0.0.1:3000");
return 0;
}
The path to sio_client.h is correct, VSCode complained when I pointed to the wrong location, and if I shift+click sio::client it does take me to the header file, but when compiling the following errors show up:
/tmp/ccuONn4Y.o: In function
main': /path/to/main.cpp:6: undefined reference to
sio::client::client()'
/path/to/main.cpp:7: undefined reference tosio::client::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /path/to/main.cpp:6: undefined reference to
sio::client::~client()'
/path/to/main.cpp:6: undefined reference to `sio::client::~client()'
collect2: error: ld returned 1 exit status
Makefile:37: recipe for target 'all' failed
My makefile looks like this:
# All purpose variables
compiler=g++
project_root = ./
# Where to store the binaries
target_folder=bin
target_bin=louise
source_to_main=src/louise/main.cpp
# Compiler flags
flags=-std=c++11 -Wall -Werror -g -v -lboost_filesystem -lboost_system
deps = ./src/louise/lib/socket.io-client-cpp/sio_client.h ./src/louise/lib/socket.io-client-cpp/lib/websocketpp ./src/louise/lib/socket.io-client-cpp/lib/rapidjson
# Compilation instructions
%.o: %.c $(deps)
$(CC) -c -o $@ $< $(flags)
all:
cd $(project_root)
if [ -a $(target_folder)/${target_bin} ]; then rm $(target_folder)/${target_bin}; fi;
$(compiler) ${source_to_main} -o $(target_folder)/${target_bin} ${flags}
I realize an ld
error is a linker error, but cant spot what's wrong in my setup, a little help please?