0

using g++ version :

g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

the lib is in path that is passed with "-L":

vagrant@vagrant:~/cpp/batch$ ls -l /home/vagrant/cpp/libhv/build/lib/
total 34988
-rwxrwxr-x 1 vagrant vagrant  9376136 Dec 29 09:23 libhv.so
-rw-rw-r-- 1 vagrant vagrant 26446694 Dec 29 09:24 libhv_static.a

The errors -llibhv_static:

g++ -fdiagnostics-color=always -Wall -I/home/vagrant/cpp/batch/ -I/home/vagrant/cpp/libhv/build/include/hv/ -std=c++14  -L/home/vagrant/cpp/libhv/build/lib/ -llibhv_static -pthread -g /home/vagrant/cpp/batch/main.cpp -o /home/vagrant/cpp/batch/main.exe
/usr/bin/ld: cannot find -llibhv_static
collect2: error: ld returned 1 exit status

with -lhv_static.a

g++ -fdiagnostics-color=always -Wall -I/home/vagrant/cpp/batch/ -I/home/vagrant/cpp/libhv/build/include/hv/ -std=c++14  -L/home/vagrant/cpp/libhv/build/lib/ -lhv_static.a -pthread -g /home/vagrant/cpp/batch/main.cpp -o /home/vagrant/cpp/batch/main.exe
/usr/bin/ld: cannot find -lhv_static.a
collect2: error: ld returned 1 exit status

and with -lhv_static

g++ -fdiagnostics-color=always -Wall -I/home/vagrant/cpp/batch/ -I/home/vagrant/cpp/libhv/build/include/hv/ -std=c++14  -L/home/vagrant/cpp/libhv/build/lib/ -lhv_static -pthread -g /home/vagrant/cpp/batch/main.cpp -o /home/vagrant/cpp/batch/main.exe
/tmp/ccvMCMRx.o: In function `hv_memcheck':
/home/vagrant/cpp/libhv/build/include/hv/hbase.h:54: undefined reference to `hv_free_cnt'
/home/vagrant/cpp/libhv/build/include/hv/hbase.h:54: undefined reference to `hv_alloc_cnt'
/tmp/ccvMCMRx.o: In function `main':
/home/vagrant/cpp/batch/main.cpp:40: undefined reference to `http_server_run(http_server_s*, int)'
/home/vagrant/cpp/batch/main.cpp:51: undefined reference to `http_server_stop(http_server_s*)'
collect2: error: ld returned 1 exit status
user63898
  • 29,839
  • 85
  • 272
  • 514

0 Answers0