我是C++的新手,我正在尝试制作一个小地牢爬虫游戏.目前我在头文件中声明了多个向量,但它们似乎给出了多个错误.我试过在StackOverflow上搜索这个问题,但答案似乎并没有起作用.
这是我的一个头文件:(Hero.h)
#pragma once
class Hero {
public:
Hero();
std::string name;
int experience;
int neededExperience;
int health;
int strength;
int level;
int speed;
std::vector<Item> items = std::vector<Item>();
void levelUp();
private:
};
Run Code Online (Sandbox Code Playgroud)
这是我的.cpp文件:(Hero.cpp)
#include "stdafx.h"
#include <vector>
#include "Hero.h"
#include "Item.h"
Hero::Hero() {
}
void Hero::levelUp()
{
};
Run Code Online (Sandbox Code Playgroud)
就像我说我是C++的新手,所以我的代码可能比我知道的更多错.这只是一个考验.
以下是Visual Studio 2015的错误列表中显示的错误:
Error C2039 'vector': is not a member of 'std' CPPAssessment hero.h 13
Error C2143 syntax error: missing ';' before '<' CPPAssessment hero.h 13
Error C4430 missing type specifier - …Run Code Online (Sandbox Code Playgroud) 当我包括:
#include <vld.h>;
Run Code Online (Sandbox Code Playgroud)
在我的stdafx.h中并运行我的程序,它说安装了Visual Leak Detector 2.5.我可以正常运行我的程序但是当它退出时我得到这个错误:
Exception thrown at 0x00007FFFB7F57FE7 (ntdll.dll) in CPPAssessment.exe: 0xC0000005: Access violation reading location 0x00007FFFB8095252.
If there is a handler for this exception, the program may be safely continued.
Run Code Online (Sandbox Code Playgroud)
但是,当我启用Visual Leak Detector时,我才会得到这个,所以我的猜测就是问题所在.
我找到了这个网站:Visual Leak Detector论坛有人提到了一个修复,但它导致了一个带有vld.cpp文件的github repo,我不知道该怎么做.
似乎错误是由Windows 10周年更新引起的,但我不确定.
我正在使用NodeJS和Request发布JSON并获得包含数据的结果.
我用Postman设置了这个请求,然后我获得了完全可读的JSON数据.
{
"d": {
"__type": "Qvision.WoningenModule.Lib.aanbodcollection",
"testOutput": "",
"filter": null,
...
etc.
}
}
Run Code Online (Sandbox Code Playgroud)
我从Postman生成了代码片段,因此我可以将它放在我的NodeJS服务器上,并且需要Request.
当我尝试在我的节点服务器上运行一个编码正文的请求.
??`I?%&/m?{J?J??t?`$?@???????iG#)?*??eVe]f@????{????{????;?N'????\fdl??J??!????~|?"~?G?????~???^?=??'.??????V?by?/??f?2?/&?,[N??*?|?R??F?y?~?nW??^???????-?eI?Vm???Z???????|????"???b?}?h?|+4???~QWU????>??????Ge6?ˆ?_??"????^o??bF?HO<??GM[gYK???E?\/???G[??UN^??eN???????A_??n?????Z???????f@??z?Qb=)??Z???|?Fo+z?.~m.?z????%????uMs?y1?x?uA????>??????/?fZ??h????"????Y??????@w???w????5+s;?????1??2?$??G???????????b?O??????9???~P-gy?L??|i/?????Q??$_??H??E??_?|Y???? <s8??/??8?????$???~??C?J#{?3??????o6?{?wSU4????YK???j?L?D?K?D??K?kan '$????uQ????]?? ??J4Z??????O??????O???????O~?'??~??d??N?{???G??{;?????????*??}j???O?@?N?^=??>+?D??]%QM?wjy?????????!?)? ????????g?????&????R????i?|?6??N?U?v??o?> ???;????`???xpp??"f????????;?v??U?s?y~V?????w?o?m~?:#???????x????ß??????`g??A?$?????>?G?z????b????$?;?;?_?M??lv?`??po?vxNB{Y?WP??????{{?j??t???g??????C?>1j??G jE???????Ux?/ww???b2?DI??????aK? k5???}n]???|?tgw??:?;;???J???S?O??>?O??/???\x?=?????/?>B????O???;??:??G??9?%?v<?h?^:??{|?KF????{?????o?4????.?M?<?=??w?????I????+M??>i?{????=?|o?b3??.????v?????j??n?z|x??*1u??~JF????à??????c&}m?K?????f???t???&ELF???e??>?Y????.fU??;??oh????o?????#??si?)Z????9??????~??/>?????????}???KR?Cf????=??? 6?$3??????Y5?~????vw?H??lvHf|???????Rh?s?T??g??????o{?Y1???o???{?`g_?kv???>y??>4?????;}@????l?????O*l?S#?1ey????u??????'????o??u?"???O~?,?{?????[Xo1??FQ????t???F?sk???h?|??d???????=??????>?)F??=?if3???.)?J)_?~V???>E????9?Y?????`??N??f???{? ????z?Oi????????O?}`????1?~???;v6a=???)-???6??7g?7tI???}?T???Mf??????*ofy??ZbY??.?B??M???g?l? 3???;?"???n?@_|sv{??? ????o??????@?m\"?w????o?=??,??s;?v??7??Y?r?!%???c??Y???[R7????h??X???)?}??????????~?p???~?(?c??d?g????????[1????~?H?K??h??NHT??u??5??w??????e?????LZt?)=s~??C^?v???????!K? ?????F?x?c?W-?I???U4?5?l88???;?????x??????5I?R84%?J?s??|?<????S???dQ??O????W???g?GR{?~?=???r???0????UL??bv????????&??>%"?^v??)??},?h??+v??n????33????q??Z8~H|???g?{}?k???C#??kF??????c?????^6?W??9,2?]??????0??5???X.?D?0??&;?SD(??????????? 5F?????1????<?j??#?????Q?S?m????|?%??????/?_?<~?????9?e^^??n????
??)????O????G?~?v?v?/3???i?????????g?WZP}p???p??g???????DT????l?#???{fWz??1?^?~?{??X????r??]
?vMw??)???????p`2 0??K???????m??k????|?gz?i?????| ???J????/YF??R?G?k??}b???#$?1C~g??C?C??????/? ??%K?9
Run Code Online (Sandbox Code Playgroud)
像这样.在Postman中,数据很好但在Node中却没有.怎么会这样?据我所知,我的要求没有错:
var request = require("request");
var options = { method: 'POST',
url: '****',
headers:
{ 'postman-token': '****',
cookie: '****',
'accept-language': 'nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4',
'accept-encoding': 'gzip, deflate, br',
referer: '****',
'content-type': 'application/json; charset=UTF-8',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
'x-requested-with': 'XMLHttpRequest', …Run Code Online (Sandbox Code Playgroud) 我有一个图标,需要将它所在的密码字段放入文本字段,反之亦然.
<i class="password_icon fa fa-unlock" aria-hidden="true" onmouseover="mouseOverPassword()" onmouseout="mouseOutPassword()"></i>
Run Code Online (Sandbox Code Playgroud)
但当我将鼠标悬停在图标上时,它表示:
Uncaught ReferenceError: mouseOutPassword is not defined
at HTMLElement.onmouseout ((index):1)
Run Code Online (Sandbox Code Playgroud)
即使它们在我包含的.js文件中:
function mouseOverPassword() {
var obj = $("#passworldField");
obj.type = "text";
}
function mouseOutPassword() {
var obj = $("#passworldField");
obj.type = "password";
}'
Run Code Online (Sandbox Code Playgroud)
这些函数位于$(document).ready函数中.我无法真正找出它为什么不起作用.是的,.js包含在页面上.