Этот код:
#include "Backpack.h"
#include <sstream>
#include <algorithm>
int Backpack::getCurrentWeight()
{
int weight = 0;
std::for_each(items.begin(),items.end(),[&](std::shared_ptr<PickupItem> item){ //8
weight +=item->getWeight();
});
return weight;
}
генерирует эти ошибки:
Backpack.cpp: In member function 'int Backpack::getCurrentWeight()':
Backpack.cpp:8: error: expected primary-expression before '[' token
Backpack.cpp:8: error: expected primary-expression before ']' token
Backpack.cpp:8: error: expected primary-expression before 'item'
Проект построен на Linux, а на Windows - нет. Моя версия Qt: Qt 4.7.4 для рабочего стола - MinGW 4.4 (Qt SDK). Я добавил следующий флаг: QMAKE_CXXFLAGS + = -std = c ++ 0x