Skip to content

Linux build with GCC broken due to use of C++14 features #621

@purinchu

Description

@purinchu

I tried to build this library just now using CMake 3.10.0 and gcc 7.2.0 on a Linux system.

It failed to build, giving error messages of the form:

[12/167] Building CXX object src/CMakeFiles/cpprest.dir/uri/uri.cpp.o
FAILED: src/CMakeFiles/cpprest.dir/uri/uri.cpp.o 
/usr/lib/ccache/bin/c++  -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -Dcpprest_EXPORTS -I../include -I../src/pch -I../libs/websocketpp -std=c++11 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -Werror -pedantic -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code -MD -MT src/CMakeFiles/cpprest.dir/uri/uri.cpp.o -MF src/CMakeFiles/cpprest.dir/uri/uri.cpp.o.d -o src/CMakeFiles/cpprest.dir/uri/uri.cpp.o -c ../src/uri/uri.cpp
In file included from ../src/pch/stdafx.h:99:0,
                 from ../src/uri/uri.cpp:14:
../include/pplx/pplxtasks.h:6702:79: error: ‘operator&&’ function uses ‘auto’ type specifier without trailing return type
 auto operator&&(const task<_ReturnType> & _Lhs, const task<_ReturnType> & _Rhs)
                                                                               ^
../include/pplx/pplxtasks.h:6702:79: note: deduced return type only available with -std=c++14 or -std=gnu++14

A fuller excerpt is attached at cpprestsdk-build-failure.log

The error message mentioned C++14 support being needed. I found that altering the base CMakeLists.txt to set -std=c++14 instead of its current c++11 mode when using GCC did indeed allow the library to build and link.

Poking around, it seems that the recent commit 09d5984 introduced the C++14-related changes, but I'm not sure if C++14 is supposed to be verboten or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions