缺少类型说明符 – 在C中假定为Int

缺少类型说明符 – 在C中假定为Int,第1张

概述这些第二行是抛出这个错误,但我不确定为什么. std::vector<std::string> weapons(100);weapons[3] = "Rusty dagger"; – 这是我的整个文件: //global variables#ifndef _GLOBAL_#define _GLOBAL_#include <vector>#include <iostream>#incl 这些第二行是抛出这个错误,但我不确定为什么.

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

这是我的整个文件:

//global variables#ifndef _GLOBAL_#define _GLOBAL_#include <vector>#include <iostream>#include <string>//prototypesvoID 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);//variablesstd::vector<std::string> weapons(100);weapons[3] = "Rusty dagger";//defines#define RegionChange 3#endif //__GLOBAL__
解决方法
weapons[3] = "Rusty dagger";

这是一个声明.您不能在全局范围内编写语句.你必须将它放在一个函数中.

总结

以上是内存溢出为你收集整理的缺少类型说明符 – 在C中假定为Int全部内容,希望文章能够帮你解决缺少类型说明符 – 在C中假定为Int所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1222361.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存