I don't have much experience with threads, but I couldn't help thinking this might work:
std::thread t1(f);
The function object and it's arguments are arguments to the thread constructor (you can see in the template), brace initialisation doesn't seem appropriate here.
If I omit std:: in the thread statement (and use a using namespace std statement instead), I get a similar compilation error, saying thread' is not a recognized type.
That's why I suspect a local GCC installation problem. I've been using GCC since some time now, and so far it has been working perfectly (but not for threads).
ok, what version of gcc and C::B do you have, and are you on windows?
I tried searching for std::thread gcc codeblocks but the posts were several years old, not sure whether some windows versions do now have this capability. They probably do, but I am a Linux guy :+)
I also recommend getting clang from llvm, it's better than gcc (for c++ anyway).
> I've been using GCC since some time now, and so far it has been working perfectly (but not for threads).
Standard threads do not work in many builds of MinGW. With the GNU library, standard C++ threads are only available on platforms that support for POSIX threads natively. On Windows, a MinGW implementation which has implemented a POSIX threads emulation layer is required.
Do you have the -lpthread -mthreads -pthread options for the compiler?
Not sure what the latest version of gcc minGw will support, gcc 4.8 is a little old now, current version of gcc is 6.1
I probably can't help much more than that - not sure if I have been that much help at all :+) It's also late at my end, could be heading off to stack ZZZZZZzzzzzz....... soon :+)