C/C++ Thread ve Chrono hatası

Katılım
20 Haziran 2022
Mesajlar
243
Çözümler
2
Daha fazla  
Sistem Özellikleri
İşletim Sistemi: Linux Mint Cinnamon ve Windows 11
RAM: 16 GB (13.5 GB kullanılabilir)
Sabit disk: 500 GB
Grafik/Ekran Kartı: Nviada GeForce GTX 1650 Mobile/ MAX Q
Direktx: 12
Cinsiyet
Erkek
C++:
#include <iostream>
#include <windows.h>
#include <thread>
#include <vector>
#include <numeric>
#include <chrono>
#include <ctime>

using namespace std;

void simulateFPS() {
 srand(static_cast<unsigned int>(time(nullptr)));
 vector<int> fpsValues;
 int averageFPS = 60;
 const int sampleSize = 5;

 while (true) {
 int currentFPS = rand() % 91 + 30;
 fpsValues.push_back(currentFPS);

 this_thread::sleep_for(chrono::seconds(sampleSize));

 if (!fpsValues.empty()) {
 double sum = accumulate(fpsValues.begin(), fpsValues.end(), 0.0);
 averageFPS = sum / fpsValues.size();
 }

 if (currentFPS < averageFPS * 0.75) {
 INPUT input[4] = {};
 input[0].type = INPUT_KEYBOARD;
 input[0].ki.wVk = VK_LWIN;
 input[1].type = INPUT_KEYBOARD;
 input[1].ki.wVk = VK_CONTROL;
 input[2].type = INPUT_KEYBOARD;
 input[2].ki.wVk = VK_SHIFT;

 SendInput(3, input, sizeof(INPUT));

 input[0].ki.dwFlags = KEYEVENTF_KEYUP;
 input[1].ki.dwFlags = KEYEVENTF_KEYUP;
 input[2].ki.dwFlags = KEYEVENTF_KEYUP;
 SendInput(3, input, sizeof(INPUT));
 }
 }
}

int main() {
 ShowWindow(GetConsoleWindow(), SW_HIDE);
 simulateFPS();
 return 0;
}

Şu hataları veriyor: "
[Error] 'std: This_thread' has not been declared,
[Error] 'std: Chrono' has not been declared"
 
Bi deniyim

12 22 C:\Users\lenovo\Documents\c++12 37 C:\Users\lenovo\Documents\c++\EKRANKARTIRESETZAM.cpp [Error] expected namespace-name before ';' token\EKRANKARTIRESETZAM.cpp [Error] 'chrono_literals' is not a namespace-name
 

Bu konuyu görüntüleyen kullanıcılar

Technopat Haberler

Yeni konular

Geri
Yukarı