Reputation: 2581
This code:
#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;
}
generates these errors:
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'
The project builds on Linux, but on Windows it does not. My Qt version: Qt 4.7.4 for Desktop - MinGW 4.4 (Qt SDK). I added following flag: QMAKE_CXXFLAGS += -std=c++0x
Upvotes: 0
Views: 1077