私はこの小さなプログラムを で構築しようとしていVisual C++ 2008 Express Edition
ます:
#include "stdafx.h"
#include <iostream>
#include <vector>
int main(){
std::vector<bool> listOfFeatures(4,false);
for(std::vector<bool>::iterator i = features.begin(); i != features.end(); i++){
std::int maxValue = criterionFunction(*listOfFeatures);
}
}
std::int criterionFunction(std::int *features){
return -2*features[1]*features[2]+3*features[1]+5*features[2]-2*features[1]*features[2]*
features[3]+7*features[3]+4*features[4]-2*features[1]*features[2]*features[3]*
features[4];
}
ただし、次の出力が得られます。
1>------ Build started: Project: SFS, Configuration: Debug Win32 ------
1>Compiling...
1>SFS.cpp
1>.\SFS.cpp(7) : error C2065: 'features' : undeclared identifier
1>.\SFS.cpp(7) : error C2228: left of '.begin' must have class/struct/union
1> type is ''unknown-type''
1>.\SFS.cpp(7) : error C2065: 'features' : undeclared identifier
1>.\SFS.cpp(7) : error C2228: left of '.end' must have class/struct/union
1> type is ''unknown-type''
1>.\SFS.cpp(8) : error C2589: 'int' : illegal token on right side of '::'
1>.\SFS.cpp(8) : error C2143: syntax error : missing ';' before '::'
1>.\SFS.cpp(11) : error C2589: 'int' : illegal token on right side of '::'
1>.\SFS.cpp(11) : error C2059: syntax error : '::'
1>.\SFS.cpp(11) : error C2589: 'int' : illegal token on right side of '::'
1>.\SFS.cpp(11) : error C2143: syntax error : missing ';' before '{'
1>.\SFS.cpp(11) : error C2447: '{' : missing function header (old-style formal list?)
1>Build log was saved at "file://c:\Users\Ola\Documents\Visual Studio 2008\Projects\SFS\SFS\Debug\BuildLog.htm"
1>SFS - 11 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
何故ですか?