I have gcc version 5.4.0 20160609. I try to parallize this loop below, but it doesn't want to work proprely. I tried to used examples from the internet, but wasn't helpful. How should it look like?
void Text::readText(){
std::cout<<"start reading"<<std::endl;
omp_set_num_threads(2);
#pragma omp parallel
{
std::list<std::string>::iterator it;
#pragma omp for
for (it = listOfWordsFromText.begin(); it!=listOfWordsFromText.end(); it++)
{
std::cout << *it << " thread: "<<omp_get_thread_num()<< std::endl;
}
}
}
Text.cpp:41:3: error: invalid controlling predicate for (it = listOfWordsFromText.begin(); it!=listOfWordsFromText.end(); it++)
EDIT: I can use OpenMP 4.5(i think so), version 2.0 is not up-to-date