Question

These second line of these is throwing this error, but I'm not sure why.

std::vector<std::string> weapons(100);
weapons[3] = "Rusty dagger";

--

Here's my entire file:

//global variables
#ifndef _GLOBAL_
#define _GLOBAL_

#include <vector>
#include <iostream>
#include <string>

//prototypes
void NPCTalk(std::string const& speaker,std::vector<std::string> const& text);
void wait(double seconds);
void regionChange(int amount);
int getPositionInStringVector(std::vector<std::string> const& vec,std::string value);

//variables
std::vector<std::string> weapons(100);
weapons[3] = "Rusty dagger";

//defines
#define RegionChange 3

#endif //__GLOBAL__

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top