Skip to content

[BUG] hello_world: build failed #295

Open
@dancesWithCycles

Description

@dancesWithCycles

Hi folks,
Thank you so much for maintaining this repository. May I share the following issue with you?

Describe the issue
I am following the Hello World example.

To Reproduce

I build and installed the library like this

./bootstrap
mkdir build
cd build
../configure
make
sudo make install

make install replied like this.

sudo make install
Making install in src
make[1]: Entering directory '/home/begerad/git/github/libhttpserver/build/src'
make[2]: Entering directory '/home/begerad/git/github/libhttpserver/build/src'
 /usr/bin/mkdir -p '/usr/local/lib'
 /bin/bash ../libtool   --mode=install /usr/bin/install -c   libhttpserver.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libhttpserver.so.0.19.0 /usr/local/lib/libhttpserver.so.0.19.0
libtool: install: (cd /usr/local/lib && { ln -s -f libhttpserver.so.0.19.0 libhttpserver.so.0 || { rm -f libhttpserver.so.0 && ln -s libhttpserver.so.0.19.0 libhttpserver.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libhttpserver.so.0.19.0 libhttpserver.so || { rm -f libhttpserver.so && ln -s libhttpserver.so.0.19.0 libhttpserver.so; }; })
libtool: install: /usr/bin/install -c .libs/libhttpserver.lai /usr/local/lib/libhttpserver.la
libtool: install: /usr/bin/install -c .libs/libhttpserver.a /usr/local/lib/libhttpserver.a
libtool: install: chmod 644 /usr/local/lib/libhttpserver.a
libtool: install: ranlib /usr/local/lib/libhttpserver.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib
...

I created the following makefile.

# Source, Executable, Includes, Library Defines
LIBS   = -lhttpserver
# Compiler, Linker Defines
LIBPATH = -L. -L/usr/local/lib/
LDFLAGS = -o main $(LIBPATH) $(LIBS)
RM      = /bin/rm -f
# *****************************************************
# Variables to control Makefile operation
CC = g++
CFLAGS = -Wall -g
# ****************************************************
# Targets needed to bring the executable up to date
main: main.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o main main.o 
# The main.o target can be written more simply 
main.o: main.cpp
	$(CC) $(CFLAGS) -c main.cpp 
clean:
	$(RM) main.o main

The call for make replied like this.

make
g++ -Wall -g -c main.cpp 
In file included from /usr/local/include/httpserver/basic_auth_fail_response.hpp:29,
                 from /usr/local/include/httpserver.hpp:26,
                 from main.cpp:23:
/usr/local/include/httpserver/http_utils.hpp:287:27: error: ‘std::string_view’ has not been declared
  287 |      bool operator()(std::string_view x, std::string_view y) const {
      |                           ^~~~~~~~~~~
/usr/local/include/httpserver/http_utils.hpp:287:47: error: ‘std::string_view’ has not been declared
  287 |      bool operator()(std::string_view x, std::string_view y) const {
      |                                               ^~~~~~~~~~~
/usr/local/include/httpserver/http_utils.hpp: In member function ‘bool httpserver::http::header_comparator::operator()(int, int) const’:
/usr/local/include/httpserver/http_utils.hpp:288:10: error: request for member ‘size’ in ‘x’, which is of non-class type ‘int’
  288 |          COMPARATOR(x, y, std::toupper);
      |          ^~~~~~~~~~
...

Expected behavior
I expected make to build the hello_world example.

System:

  • OS/Environment: Debian GNU/Linux 11 (bullseye)

Do you have an idea how to build this example? I am happy with each and every hint in the right direction.

Cheers!

Metadata

Metadata

Assignees

Labels

bugConfirmed bugs or reports that are very likely to be bugs.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions