repository - How to include libraries hosted on Github in a C++ project? (New C++ user - previously used language with package manager) -


i want include uwebsockets in c++ project , unclear on how this. i've compiled projects .so dependencies, when comes projects listed on github still confused.

specifically:

  • does third-party repository need compiled prior including in project?
  • where store library in source code directory?
  • how link source code third-party libraries?
  • are tools such cmake needed?

apologies in advance if these questions seem obvious or silly, come language package manager rather new me.

update

following "getting started" instruction in github repository, upon cloning repository, making sure dependencies installed , running make, following output observed:

dave@desktop:~/gitrepositories/uwebsockets$ make make `(uname -s)` make[1]: entering directory '/home/dave/gitrepositories/uwebsockets' g++   -std=c++11 -o3 -i src -shared -fpic src/extensions.cpp src/group.cpp src/networking.cpp src/hub.cpp src/node.cpp src/websocket.cpp src/httpsocket.cpp src/socket.cpp src/epoll.cpp -s -o libuws.so in file included src/websocketprotocol.h:5:0,                  src/websocket.h:4,                  src/group.h:4,                  src/group.cpp:1: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. in file included src/networking.cpp:1:0: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. in file included src/websocketprotocol.h:5:0,                  src/websocket.h:4,                  src/group.h:4,                  src/hub.h:4,                  src/hub.cpp:1: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. in file included src/socket.h:4:0,                  src/node.h:4,                  src/node.cpp:1: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. in file included src/websocketprotocol.h:5:0,                  src/websocket.h:4,                  src/websocket.cpp:1: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. in file included src/socket.h:4:0,                  src/httpsocket.h:4,                  src/httpsocket.cpp:1: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. in file included src/socket.h:4:0,                  src/socket.cpp:1: src/networking.h:7:30: fatal error: openssl/opensslv.h: no such file or directory  #include <openssl/opensslv.h>                               ^ compilation terminated. makefile:8: recipe target 'linux' failed make[1]: *** [linux] error 1 make[1]: leaving directory '/home/dave/gitrepositories/uwebsockets' makefile:6: recipe target 'default' failed make: *** [default] error 2 

just answer questions:

does third-party repository need compiled prior including in project?

yes, must compile library before, because cannot link program without library.

where store library in source code directory?

make install 

will take care of this.

how link source code third-party libraries?

you don't link source code, object files libraries form executable. looks more or less

g++ -o sample main.o second.o more.o -l/path/to/libs -luws -lmorelibs 

are tools such cmake needed?

not in case, uwebsockets uses make, nothing else.


the error messages missing header files. means, must install appropriate developer packages prerequisites, namely openssl , zlib.

for debian/ubuntu done by

sudo apt-get install libssl-dev zlib1g-dev 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -