使用win7 x86和vs2012 我有这样的代码:
#include <ppl.h>
#include "concurrent_vector.h"
.....
int pretendletternum[16];
parallel_for(int(0), pretendletternum[vs[vs.size()-1].index], [=,&wordd](int a1)
{
wchar_t worddd[17]; memcpy(worddd,wordd,sizeof(wchar_t)*wordlenght);
int pretset1 = 0;
int index1 =vs[vs.size()-1].index;
worddd[index1] = (wchar_t)pretendletter[index1][a1];
pretset1|=(1<<index1);
for(int a2 = 0; (questionnum>1)&&(a2<pretendletternum[vs[vs.size()-2].index]);a2++)
{
int index2 = vs[vs.size()-2].index;
worddd[index2] = (wchar_t)pretendletter[index2][a2];
int pretset2 = pretset1;
pretset2|=(1<<index2);
for(int a3 = 0; (questionnum>2)&&(a3<pretendletternum[vs[vs.size()-3].index]);a3++)
{
int index3 = vs[vs.size()-3].index;
worddd[index3] = (wchar_t)pretendletter[index3][a3];
int pretset3 = pretset2;
pretset3|=(1<<index3);
if(!(CheckLetterInWordWithoutSaveUni(worddd,index3,pretset3))) continue;
else if (questionnum==3) { SaveFoundWordParallel(worddd,wordlenght); continue;}
for(int a4 = 0; (questionnum>3)&&(a4<pretendletternum[vs[vs.size()-4].index]);a4++)
{
int index4 = vs[vs.size()-4].index;
worddd[index4] = (wchar_t)pretendletter[index4][a4];
int pretset4 = pretset3;
pretset4|=(1<<index4);
if(!(CheckLetterInWordWithoutSaveUni(worddd,index4,pretset4))) continue;
else if (questionnum==4) { SaveFoundWordParallel(worddd,wordlenght); continue;}
...
});
得到这样的错误
错误C3861:'parallel_for':未找到标识符
但是visual studio给出了“goto定义”,我有一个非常相似的项目,它编译得很好。 vs vs可以“ - ”我的parallel_for abstract
答案 0 :(得分:0)
尝试编写:concurrency::parallel_for
或者只是事先声明using namespace concurrency