You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`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
The text was updated successfully, but these errors were encountered:
marcoippolito
changed the title
error compilation with clang 6.0.1 : #include <experimental/filesystem>
error compilation with clang 6.0.1 : 4 errors generated
Jun 8, 2018
This particular sample currently isn’t supported on Linux as the file I/O abstractions are currently only implemented for Windows.
There is some progress towards implementing Linux I/O support in #64 but I still need to do a bit more work on it. The rest of the non-I/O abstractions should work ok under Linux/Clang.
Hi,
I'm trying to compile with clang my very first example of cppcoro usage in my Ubuntu 16.04 Server Edition:
What am I missing?
Marco
The text was updated successfully, but these errors were encountered: