Qt файл считается вирусом и не запускается

Я недавно сделал файл Qt и только что скомпилировал его. Сразу после компиляции мой антивирус Avast блокирует его как вирус. Я потратил часы, пытаясь найти синтаксическую ошибку / бесконечный цикл / ошибку ввода. Я прочитал другие вопросы и погуглил проблему. Я пришел к выводу, что это вне моего понимания. Вот мои файлы:

top_secret.h

#ifndef TOP_SECRET_H
#define TOP_SECRET_H

#include <QtGui>

class top_secret : public QMainWindow
{
Q_OBJECT
public:
top_secret();

private slots:
void password_ckeck();
void go_to_page_1();
void go_to_page_2();
void go_to_page_3();
void go_to_page_4();
void quit();
void lock();
void about();

private:
QStackedWidget *book;

QWidget *lock_window;
QWidget *window1;
QWidget *window2;
QWidget *window3;
QWidget *window4;

QLineEdit *input;

QAction *quit_action;
QAction *lock_action;
QAction *about_action;

QMenu *fileMenu;
};
#endif

submain.cpp

#include "top_secret.h"
top_secret::top_secret(){
//main things
quit_action = new QAction(tr("Quit"), this);
about_action = new QAction(tr("About"), this);
lock_action = new QAction(tr("Lock"), this);

connect(quit_action, SIGNAL(triggered()), this, SLOT(quit()));
connect(about_action, SIGNAL(triggered()), this, SLOT(about()));
connect(lock_action, SIGNAL(triggered()), this, SLOT(lock()));

fileMenu = menuBar() -> addMenu(tr("File"));
fileMenu -> addAction(lock_action);
fileMenu -> addAction(about_action);
fileMenu -> addSeparator();
fileMenu -> addAction(quit_action);

book = new QStackedWidget;

//lock window
lock_window = new QWidget;

QLabel *label = new QLabel(tr("Enter password"));
input = new QLineEdit;
QPushButton *button = new QPushButton(tr("Go"));

connect(button, SIGNAL(clicked()), this, SLOT(password_ckeck()));

QHBoxLayout *lock_layout;
lock_layout -> addWidget(label);
lock_layout -> addWidget(input);
lock_layout -> addWidget(button);
lock_window -> setLayout(lock_layout);

//window 1
window1 = new QWidget;
QLabel *label1 = new QLabel("Name: Jakub Jagielski<br>Date of birth: 21/01/2014<br>Gender: Male<br>\
Interested in: Women<br>Hair colour: Brown<br>Eye colour: brown");
QPushButton *button1 = new QPushButton(tr("Next"));

connect(button1, SIGNAL(clicked()), this, SLOT(go_to_page_2()));

QVBoxLayout *layout1;
layout1 -> addWidget(label1);
layout1 -> addWidget(button1);
window1 -> setLayout(layout1);

//window 2
window2 = new QWidget;
QLabel *label2 = new QLabel("Interests: Piano playing, science,<br>programming, computer science,<br>\
Xbox 360 playing, reading facts,<br>Logical puzzles, security programs,<br>bypassing self-made security \
programs,<br>creating complex security programs,<br>creating 2D games in Python tkinter,<br>creating apps \
like this one.");
QPushButton *button2previous = new QPushButton("back");
QPushButton *button2next = new QPushButton("next");

connect(button2previous, SIGNAL(clicked()), this, SLOT(go_to_page_1()));
connect(button2next, SIGNAL(clicked()), this, SLOT(go_to_page_3()));

QHBoxLayout *layout2bottom;
QVBoxLayout *layout2;
layout2bottom -> addWidget(button2previous);
layout2bottom -> addWidget(button2next);
layout2 -> addWidget(label2);
layout2 -> addLayout(layout2bottom);
window2 -> setLayout(layout2);

//window 3
window3 = new QWidget;
QLabel *label3 = new QLabel("Programming languages known by this user<br>rated out of 10:<br>\
Python: 9/10<br>C++: 8/10<br>Java: 5/10<br>HTML/Css/JavaScript: 8/10<br>PHP: 2/10<br>Batch: 5/10<br>");
QPushButton *button3previous = new QPushButton("back");
QPushButton *button3next = new QPushButton("next");

connect(button3previous, SIGNAL(clicked()), this, SLOT(go_to_page_2()));
connect(button3next, SIGNAL(clicked()), this, SLOT(go_to_page_4()));

QHBoxLayout *layout3bottom;
QVBoxLayout *layout3;
layout3bottom -> addWidget(button3previous);
layout3bottom -> addWidget(button3next);
layout3 -> addWidget(label3);
layout3 -> addLayout(layout3bottom);
window3 -> setLayout(layout3);

//window 4
window4 = new QWidget;
QLabel *label4 = new QLabel("This app has only been created <br> to try to make an app with<br>\
C++ and its wonderful library called Qt.<br>This person's account hasn't been<br>really hacked. In \
fact, the person<br>has made this app himself.");
QPushButton *button4previous = new QPushButton("back");
QPushButton *button4end = new QPushButton("quit");

connect(button4previous, SIGNAL(clicked()), this, SLOT(go_to_page_3()));
connect(button4end, SIGNAL(clicked()), this, SLOT(quit()));

QHBoxLayout *layout4bottom;
QVBoxLayout *layout4;
layout4bottom -> addWidget(button4previous);
layout4bottom -> addWidget(button4end);
layout4 -> addWidget(label4);
layout4 -> addLayout(layout4bottom);
window4 -> setLayout(layout4);

//main
book -> addWidget(lock_window);
book -> addWidget(window1);
book -> addWidget(window2);
book -> addWidget(window3);
book -> addWidget(window4);

setCentralWidget(book);
}

void top_secret::password_ckeck(){
QString attempt = input -> text();
if (attempt == "Jakub"){
top_secret::book -> setCurrentIndex(1);
}
}

void top_secret::go_to_page_1(){
top_secret::book -> setCurrentIndex(1);
}

void top_secret::go_to_page_2(){
top_secret::book -> setCurrentIndex(2);
}

void top_secret::go_to_page_3(){
top_secret::book -> setCurrentIndex(3);
}

void top_secret::go_to_page_4(){
top_secret::book -> setCurrentIndex(4);
}

void top_secret::lock(){
top_secret::book -> setCurrentIndex(0);
}

void top_secret::quit(){
QMessageBox messagebox;
messagebox.setText("Do you really wish to quit?");
messagebox.setWindowTitle("exit?");
messagebox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (messagebox.exec() == QMessageBox::Yes){
close();
}
}

void top_secret::about(){
QMessageBox messagebox2;
messagebox2.setText("This app is a test to try out my new C++ abilities. This app \
would take me half the time it took me if I wrote it in Python.");
messagebox2.setWindowTitle("About");
messagebox2.exec();
}

main.cpp

#include "top_secret.h"#include <QApplication>

int main(int argc, char *argv[]){
QApplication app(argc, argv);
top_secret *program = new top_secret;
program -> show();
return app.exec();
}

Я очень сожалею о количестве кода и не ожидаю идеального ответа, но если бы я мог понять, что я сделал неправильно, я был бы очень рад. Кроме того, когда я добавляю файл, который должен игнорировать мой антивирус, он просто не запускается.

Обратите внимание, что другие мои программы на Qt работают нормально, поэтому я уверен, что это связано с моим кодом.

0

Решение

У меня была такая же проблема с avast. Но это не было чем-то конкретным в Qt. Avast заблокировал все, что я запрограммировал.

Вам просто нужно зайти в настройки и снять флажок с надписью «неизвестный источник». Avast не знает, откуда взялась ваша программа, и блокирует ее, потому что это может быть вирус. По крайней мере, это то, что avast сделал с моими программами. После того, как я снял этот флажок, все работало нормально.

1

Другие решения