문제

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__

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top