8000 error compilation with clang 6.0.1 : 4 errors generated · Issue #84 · lewissbaker/cppcoro · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
error compilation with clang 6.0.1 : 4 errors generated #84
Closed
@marcoippolito

Description

@marcoippolito

Hi,

`clang -v
 clang version 6.0.1-svn333623-1~exp1~20180604222746.83 (branches/release_60)
`

I'm trying to compile with clang my very first example of cppcoro usage in my Ubuntu 16.04 Server Edition:

  `#include <cppcoro/read_only_file.hpp>
  #include <cppcoro/task.hpp>
  cppcoro::task<int> count_lines(std::string path)
  {
  auto file = co_await cppcoro::read_only_file::open(path);
  int lineCount = 0;
  char buffer[1024];
  size_t bytesRead;
  std::uint64_t offset = 0;
  do
  {
    bytesRead = co_await file.read(offset, buffer, sizeof(buffer));
    lineCount += std::count(buffer, buffer + bytesRead, '\n');
    offset += bytesRead;
  } while (bytesRead > 0);
  co_return lineCount;
}
cppcoro::task<> usage_example()
{
  // Calling function creates a new task but doesn't start
  // executing the coroutine yet.
  cppcoro::task<int> countTask = count_lines("foo.txt");
  // ...
// Coroutine is only started when we later co_await the task.
  int lineCount = co_await countTask;
  std::cout << "line count = " << lineCount << std::endl;
}
`

`clang++ -std=c++17 -fcoroutines-ts -stdlib=libc++ -Wall -pedantic coroExample01.cpp 
-ocoroExample01 -lc++experimental
In file included from coroExample01.cpp:1:
In file included from /usr/include/cppcoro/read_only_file.hpp:8:
/usr/include/cppcoro/readable_file.hpp:47:3: error: unknown type name 'file_read_operation'
                file_read_operation read(
                ^
/usr/include/cppcoro/readable_file.hpp:52:3: error: unknown type name 
' file_read_operation_cancellable'
                file_read_operation_cancellable read(
                ^
coroExample01.cpp:6:58: error: too few arguments to function call, expected at least 2, have 1
  auto file = co_await cppcoro::read_only_file::open(path);
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     ^
/usr/include/cppcoro/read_only_file.hpp:44:3: note: 'open' declared here
                static read_only_file open(
                ^
3 errors generated.
`

What am I missing?
Marco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0