jpbarrette/curlpp

Compiling with Clang

ktwrd opened this issue · 4 comments

ktwrd commented

I am having an issue with compiling with clang-1000.11.45.5 on MacOS 10.13.6

All that is being done is including curlpp (including it is completely fine)

Includes

#include <iostream>
#include "curlpp/cURLpp.hpp"
#include "curlpp/Options.hpp"

Shell Output

λ clang++ main.cpp
In file included from main.cpp:1:
In file included from ./main.h:3:
In file included from ./curlpp/Options.hpp:28:
In file included from ./curlpp/Option.hpp:251:
In file included from ./curlpp/Option.inl:27:
In file included from ./curlpp/internal/OptionSetter.hpp:29:
./curlpp/internal/CurlHandle.hpp:185:42: error: implicit instantiation of
      undefined template 'std::__1::function<int (double, double, double,
      double)>'
                curlpp::types::ProgressFunctionFunctor mProgressFunctor;
                                                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1412:48: note:
      template is declared here
template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined
                                               ^
In file included from main.cpp:1:
In file included from ./main.h:3:
In file included from ./curlpp/Options.hpp:28:
In file included from ./curlpp/Option.hpp:251:
In file included from ./curlpp/Option.inl:27:
In file included from ./curlpp/internal/OptionSetter.hpp:29:
./curlpp/internal/CurlHandle.hpp:134:66: error: implicit instantiation of
      undefined template 'std::__1::function<int (double, double, double,
      double)>'
  ...void setProgressFunctor(curlpp::types::ProgressFunctionFunctor functor)
                                                                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1412:48: note:
      template is declared here
template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined
                                               ^
2 errors generated.

clang -v Output

λ clang -v
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I don't know the MacOs ecosystem, but I presume here that something needs update in your system : must probably the C++ support version provided by the toolchain.
std::function is provided since C++11, and previous instances of std::function (WriteFunctionFunctor, ReadFunctionFunctor...) don't seems to be problems. And nothing seems to be exotic in the ProgressFunctionFunctor definition.
So I suggest to update the toolchain.