Languages

Menu
Sites
Language
std::thread

Hi,

I'm trying to use std::thread in some C++ code, but just including <thread> gives me this error:

In file included from /Users/steve/tizen-studio/tools/smart-build-interface/../arm-linux-gnueabi-gcc-4.6/lib/gcc/arm-linux-gnueabi/4.6.4/../../../../arm-linux-gnueabi/include/c++/4.6.4/thread:38:

/Users/steve/tizen-studio/tools/smart-build-interface/../arm-linux-gnueabi-gcc-4.6/lib/gcc/arm-linux-gnueabi/4.6.4/../../../../arm-linux-gnueabi/include/c++/4.6.4/chrono:535:6: error: no matching constructor for initialization of 'duration' (aka 'std::chrono::duration<long long, std::ratio<1, 1000000> >')

          : __d(__t.time_since_epoch())

Is std::thread supported?

Responses

8 Replies
Eugene Kurzberg

It is possible that you are using an old toolchain. As far as I know Tizen Studio has GCC 4.9. Try switching the compiler in your project settings.

Steven Merel

It only gives me the choice between GCC 4.6 and LLVM-GCC 4.6.  I'm using Tizen Studio 1.0, recently downloaded from https://developer.tizen.org/development/tizen-studio/download.  Is there a more up-to-date compiler available somewhere?

Eugene Kurzberg

You can install GCC 4.9 from Package Manager->Tizen SDK Tools->Native toolchain->Gcc 4.9 toolchain.

Steven Merel

It worked for me.  Be sure you select LLVM GCC-4.9 in Project Properties -> C/C++ Build -> Tizen Settings.

Mehedi Alamgir

I select LLVM GCC-4.9(default) but still it shows error. Errors are

1. ninja: build stopped: subcommand failed

2. no member named 'thread' in namespace 'std'

3.  This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.   Check   line 32, external location: /home/mehedi/tizen-studio/tools/i386-linux-gnueabi-gcc-4.9/i386-linux-gnueabi/include/c++/4.9.2/bits/c++0x_warning.h 

Steven Merel

You also need to set the dialect in Project Properties -> C/C++ Build -> Settings. Under C++ Compiler / Dialect, set the language standard to C++11.

Mehedi Alamgir

Thank you Steven. It works fine now.