尝试构建示例代码时出现编译错误

时间:2016-11-03 08:08:33

标签: c++ cmake c++-actor-framework

我在cmake之后遇到了这个错误然后make。我已将所有依赖项安装为configuration..thanks

ME664JA-no-MacBook-Pro:examples ME664JA$ make
    [  0%] Built target all_examples
    [  1%] Building CXX object CMakeFiles/curl_fuse.dir/curl/curl_fuse.cpp.o
    In file included from /Users/ME664JA/Projects/actor-framework/examples/curl/curl_fuse.cpp:45:
    In file included from /usr/local/include/caf/all.hpp:25:
    In file included from /usr/local/include/caf/sec.hpp:27:
    In file included from /usr/local/include/caf/error.hpp:27:
    /usr/local/include/caf/fwd.hpp:111:12: error: ISO C++ forbids forward references to 'enum' types
    enum class atom_value : uint64_t;
               ^
    /usr/local/include/caf/fwd.hpp:111:23: error: expected unqualified-id
    enum class atom_value : uint64_t;
                          ^
    In file included from /Users/ME664JA/Projects/actor-framework/examples/curl/curl_fuse.cpp:45:
    In file included from /usr/local/include/caf/all.hpp:25:
    In file included from /usr/local/include/caf/sec.hpp:27:
    In file included from /usr/local/include/caf/error.hpp:28:
    In file included from /us`enter code here`r/local/include/caf/atom.hpp:27:
    /usr/local/include/caf/detail/atom_val.hpp:29:1: error: unknown type name 'constexpr'
    constexpr unsigned char encoding_table[] = {
    ^
    /usr/local/include/caf/detail/atom_val.hpp:29:11: error: expected unqualified-id
    constexpr unsigned char encoding_table[] = {

2 个答案:

答案 0 :(得分:2)

C ++ Actor Framework由C ++ 11编写,将其中一行添加到CMakeLists.txt

set (CMAKE_CXX_STANDARD 14)

set (CMAKE_CXX_STANDARD 11)

答案 1 :(得分:0)

此示例适用于我

project(projectCAF)
cmake_minimum_required(VERSION 3.6)

set(CMAKE_CXX_STANDARD 11)
set(CAF_INCLUDE_ALL /usr/local/include/caf)

include_directories(${CAF_INCLUDE_ALL})
link_directories(/usr/local/lib)


macro(add executable folder source)
  add_executable(${executable} ${folder}/${source}.cpp )

  target_link_libraries(${executable} "libcaf_core.so")
endmacro()

add(one . hello)