V
V
Vrnv2020-03-23 23:09:07
WordPress
Vrnv, 2020-03-23 23:09:07

What's wrong with the flow?

I started to get acquainted with streams and at the first attempt to "feel" this I caught an error:
(Compiler GCC 8.2.0)

Imagine.cpp: In function 'void foo()':
Imagine.cpp:6:10: error: 'std::this_thread' has not been declared
     std::this_thread::sleep_for(std::chrono::milliseconds(4000));
          ^~~~~~~~~~~
Imagine.cpp: In function 'int main()':
Imagine.cpp:11:10: error: 'thread' is not a member of 'std'
     std::thread test(foo);
          ^~~~~~
Imagine.cpp:11:10: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
Imagine.cpp:3:1:
+#include <thread>
 #include <chrono>
Imagine.cpp:11:10:
     std::thread test(foo);
          ^~~~~~
Imagine.cpp:13:5: error: 'test' was not declared in this scope
     test.join();
     ^~~~
Imagine.cpp:13:5: note: suggested alternative: 'tzset'
     test.join();
     ^~~~
     tzset


The code itself:
#include <iostream>
#include <thread>
#include <chrono>
void foo(){
    std::cout<<"Thread"<<std::endl;
    std::this_thread::sleep_for(std::chrono::milliseconds(4000));
    std::cout<<"END"<<std::endl;
}

int main(){
    std::thread test(foo);

    test.join();
    return 0;
}


The fact is that online compilers do not produce errors.
Question: What could be the reason that I can't find the library? I checked: it lies in the compiler paths, but still the output is zero!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Access Denied, 2019-08-29
@AccessDenied80

In the form, send name="add-to-cart[]", instead of name="add-to-cart", also with quantity.
It turns out /configurator/?add-to-cart[]=17617&add-to-cart[]=13132&quantity[]=1&quantity[]=4
Then parse the get request on the server side and fix the form processing.
Everything is simple.

A
Armenian Radio, 2020-03-23
@gbg

-std=c++11 in compiler options?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question