Closed andersondn closed 5 years ago
hmm, you're supposed to give g++ the argument -std=c++17
, the errors suggests that you didn't give it -std=c++17
how did you run g++ ?
I'm running as say in the tutorial...
anderson@Anderson-PC:~/cacdrive$ g++ src/main.cpp -std=c++17 -lcurl -lpthread -O2
src/main.cpp:62:1: error: ‘shared_mutex’ does not name a type
shared_mutex io_cache_mutex;
anderson@Anderson-PC:~/cacdrive$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
going by https://stackoverflow.com/a/42302130/1067003 and https://en.cppreference.com/w/cpp/compiler_support , g++ didn't really support c++17's shared_mutex
until the g++ 6.0.0 release,
can you try running
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-6 g++-6
then try to compile with
g++-6 src/main.cpp -std=c++17 -lcurl -lpthread -O2
and show me the full command line log?
closing due to lack of feedback. @andersondn if you still want help, provide an answer to the the previous comment
src/main.cpp:62:1: error: ‘shared_mutex’ does not name a type shared_mutex io_cache_mutex; ^ src/main.cpp: In function ‘void print_io_cache()’: src/main.cpp:1004:2: error: ‘io_cache_mutex’ was not declared in this scope io_cache_mutex.lock_shared(); ^ src/main.cpp: In lambda function: src/main.cpp:1029:9: error: ‘io_cache_mutex’ was not declared in this scope io_cache_mutex.lock_shared(); ^ src/main.cpp: In function ‘void cac_upload_eventually(uint64_t, uint32_t, const char, FILE)’: src/main.cpp:1152:3: error: ‘io_cache_mutex’ was not declared in this scope io_cache_mutex.lock(); ^ src/main.cpp: In function ‘void cac_get_data(Downloadcacapi&, uint64_t, uint32_t, char, FILE)’: src/main.cpp:2378:3: error: ‘io_cache_mutex’ was not declared in this scope io_cache_mutex.lock_shared(); ^