English 中文(简体)
Problem with futures in c++0x
原标题:
  • 时间:2010-05-31 02:33:16
  •  标签:
  • c++11
  • future

I have written a small program , to understand how futures work in c++0x. while running the code I get an error like " error: printEn was not declared in this scope". I am unable to understand what the problem is..Kindly point out what I am doing wrong here and if possible write the correct code for the same..

#include <future>
#include <iostream>

using namespace std;


int printFn()
{
    for(int i = 0; i < 100; i++) 
    {

        cout << "thread " <<  i << endl;
    }

    return 1;
}



int main()
{

    future<int> the_answer2=async(printEn);
    future<int> the_answer1=async(printEn);


   return 0;
}

Edit :

After making the change to printFn while running the program i get an error message " version `GLIBCXX_3.4.14 not found (required by ./a.out)". what does this indicate ?

最佳回答

Wrong function name printEn <-> printFn.

问题回答

暂无回答




相关问题
Problem with futures in c++0x

I have written a small program , to understand how futures work in c++0x. while running the code I get an error like " error: printEn was not declared in this scope". I am unable to understand what ...

Understanding future/threading

I am trying to use futures for the first time. It seems smart that you can cancel a job, but it is not working as expected. In the example below, only the first job is cancelled. The rest are ...

java.util.concurrent.Future.get() not returning

I have the following Java code: final Future future = exeService.submit( new Runnable() { public void run() { myObject.doSomething(); } } ); future.get(); where ...

ability to get the progress on a Future<T> object

With reference to the java.util.concurrent package and the Future interface I notice (unless I am mistaken) that the ability to start a lengthy tasks and be able to query on the progress only comes ...

热门标签