SORU
27 Aralık 2011, Salı


Doğru bağlantı std kullanmak için seçenekler::linux altında GCC konu?

Merhaba G std::thread kullanmaya çalışıyorum . İşte benim test kodu

#include <thread>
#include <iostream>

int main(int, char **){
    std::thread tt([](){ std::cout<<"Thread!"<<std::endl; });
    tt.join();
}

Derler, ama çalıştırmak için çalışırken bir sonucu olarak ortaya

terminate called after throwing an instance of 'std::system_error'
  what():  Operation not permitted 
Aborted

Derleyici benim sürüm:

$ g   --version
g   (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Benim test kodu ile yanlış nedir?

GÜNCELLEME: aşağıdaki komut satırı ve benim kod çalıştırmak için kullanıyorum.

$ g   -std=c  0x test.cpp
$ ./a.out

ve ben çalışılmıştır

$ g   -std=c  0x -lpthread test.cpp
$ ./a.out

hala aynı.

GÜNCELLEME: aşağıdaki derleme komutu çalışıyor.

$ g   -std=c  0x test.cpp -lpthread
$ ./a.out
Thread!

CEVAP
27 Aralık 2011, Salı


Linux pthread -pthread derleyici seçeneği belirtmeniz gerekir böylece std::thread uygulamak için kullanılır sanırım.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Day9TV

    Day9TV

    22 NİSAN 2010
  • Dylan Brenan

    Dylan Brenan

    22 Aralık 2009
  • jat4011

    jat4011

    16 EKİM 2010