制作了一个十字准线随机化器,可以发布到剪贴板,但它不会构建或调试(c ++)



我为csgo制作了一个十字线随机化器,它也将字符串发布到我的剪贴板,我想知道为什么它不会调试或构建?我已经包含了外部库,找不到任何简单的错误。我有点新,我编码已经一年了。

这是我正在使用的库:<https://github.com/Arian8j2/ClipboardXX这是我调试时的控制台和错误列表:https://i.stack.imgur.com/2ASpi.jpg

#include <iostream>
#include <Windows.h>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <clipboardxx.hpp>
using namespace std;

int main()
{
bool running = true;

while (running == true)
{
srand(time(NULL));
float chSize = rand() % 4;
int chThickness = rand() % 1;
int chDot = rand() % 1;
int chOutline = rand() % 1;
float chOutlineThickness = rand() % 1;
int chAlpha = rand() % 155 + 101;
int chStyle = rand() % 6 + 3;
int chGap = rand() % -12 + 13;
int chWeaponGap = rand() % 1;
string answer = "0";
string crosshairCode = "cl_crosshairsize " + chSize + "; "
+ "cl_crosshairthickness " + chThickness + "; "
+ "cl_crosshairdot " + chDot + "; "
+ "cl_crosshair_drawoutline " + chOutline + "; "
+ "cl_crosshair_outline_thickness " + chOutlineThickness + "; "
+ "cl_crosshairalpha " + chAlpha + "; "
+ "cl_crosshairstyle " + chStyle + "; "
+ "cl_crosshairgap " + chGap + "; "
+ "cl_crosshairgap_useweaponvalue " + chWeaponGap + "; ";
clipboardxx::clipboard clipboard;
clipboard << crosshairCode;
string paste_text;
clipboard >> paste_text;
cout << "Here is your crosshaircommand: ";
cout << crosshairCode;
cout << endl;
cout << endl;
cout << "It has been pasted to your clipboard aswell!" << endl;
cout << "Do you want a new crosshair?" << endl;
cout << "Answer (Y/N): ";
cin >> answer;
if (answer == "Y" || "y")
{
system("cls");
running = true;
}
else if (answer == "N" || "y")
{
system("cls");
running = false;
}
}
}

如果不先将数字转换为字符串,就无法将其连接到字符串。std::to_string可以做到这一点,但在这种情况下,使用字符串流更容易:

ostringstream ss; // output string stream
ss << "cl_crosshairsize " << chSize << "; "
<< "cl_crosshairthickness " << chThickness << "; "
<< "cl_crosshairdot " << chDot << "; "
<< "cl_crosshair_drawoutline " << chOutline << "; "
<< "cl_crosshair_outline_thickness " << chOutlineThickness << "; "
<< "cl_crosshairalpha " << chAlpha << "; "
<< "cl_crosshairstyle " << chStyle << "; "
<< "cl_crosshairgap " << chGap << "; "
<< "cl_crosshairgap_useweaponvalue " << chWeaponGap << "; ";
string crosshairCode = ss.str();

你需要#include <sstream>才能使用它。

最新更新