Am trying to build a sample code shared in below link http://ift.tt/1Jpe13R
with cross compiler as mentioned which is 4.9.3 and get the error for std::promise as "has incomplete type and cannot be defined"
*C:\>arm-none-eabi-g++.exe -std=c++11 -lpthread t
est.cpp
test.cpp: In function 'void accumulate(std::vector<int>::iterator, std::vector<i
nt>::iterator, std::promise<int>)':
test.cpp:9:35: error: 'accumulate_promise' has incomplete type
std::promise<int> accumulate_promise)
^
In file included from test.cpp:3:0:
c:\users\h191340\desktop\arm4.9\arm-none-eabi\include\c++\4.9.3\future:123:11: e
rror: declaration of 'class std::promise<int>'
class promise;
^
test.cpp: In function 'int main()':
test.cpp:18:23: error: aggregate 'std::promise<int> accumulate_promise' has inco
mplete type and cannot be defined
std::promise<int> accumulate_promise;
^
test.cpp:19:22: error: variable 'std::future<int> accumulate_future' has initial
izer but incomplete type
std::future<int> accumulate_future = accumulate_promise.get_future();
^
test.cpp:20:5: error: 'thread' is not a member of 'std'
std::thread work_thread(accumulate, numbers.begin(), numbers.end(),
^
test.cpp:24:5: error: 'work_thread' was not declared in this scope
work_thread.join(); // wait for thread completion
^*
Aucun commentaire:
Enregistrer un commentaire