Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9200115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:41:38+00:00 2026-06-17T22:41:38+00:00

what am I doing wrong? #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include fileoperations.h namespace

  • 0

what am I doing wrong?

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "fileoperations.h"

namespace Ui {
class MainWindow;
}
class FileOperations;
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    FileOperations FileController;

private slots:
    void on_OpenButton_clicked();
    void on_SaveButton_clicked();
    void on_EncodeButton_clicked();
    void on_DecodeButton_clicked();
private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

When i try to compile and run the program, it says:

g:\ke\c++ projects\projects\qt\shitlencoder\mainwindow.h:18: error: C2079: 'MainWindow::FileController' uses undefined class 'FileOperations'

Here’s the strange thing, if I change ‘FileOperations FileController;’ to ‘FileOperations *FileController;'(Obviously this compiles wrongly, because the rest of my codes that you can’t see havn’t been adapted to ‘->’ instead of ‘.’)
Then if I change it back to ‘FileOperations FileController;’ it lets me compile the program once (And it works fine), then it has the error the next time I try to compile it.

I’m using Qt 5.0.

fileoperations.h:

#ifndef FILEOPERATIONS_H
#define FILEOPERATIONS_H
#include "ui_mainwindow.h"
#include "mainwindow.h"
#include <QFileDialog>
#include <string>
#include <time.h>
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <fstream>
using namespace std;
class FileOperations
{
public:
    FileOperations();
    void SetInputFile(QString x);
    void SetOutputFile(QString x);
    void EncryptAndSave(Ui::MainWindow *NUI);
    void DecryptAndSave(Ui::MainWindow *NUI);
    void createid(int id, int id2);
    int GetCFuncion();
    void SetCFuncion(int x);
    long long Get_Size(string filename);
    bool Get_Toobig(string path);
    //DWORD WINAPI Thread_no_1();
private:
    string InputFilename;
    string OutputFilename;
    int CFuncion;//CurrentFunction;
    vector<int> conbyte1;
    vector<int> conbyte2;
    vector<int> opbyte1;
    vector<int> opbyte2;
    vector<int> passwordbytes;
};

#endif // FILEOPERATIONS_H
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:41:39+00:00Added an answer on June 17, 2026 at 10:41 pm

    Since you are holding a FileOperations object in your class, you need the full class declaration. This means you have to include the header, you cannot simply forward declare the class like you are doing now. If you hold only a pointer, and do not have any code in your header that attempts to dereference the pointer, then the forward declaration is enough.

    EDIT You have a cyclical include. You are including mainwindow.h in fileoperations.h. You can fix if by removing that include completely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What am I doing wrong? #include <vector> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> using namespace std;
The code of Game.h : #ifndef GAME_H #define GAME_H class Game { public: const
#ifndef LISTTEST_H #define LISTTEST_H #include <vector> #include <string> template <class T> class ListTest {
what am I doing wrong in this code.. I should get the class name
What am I doing wrong here folks? <?php include 'header.php'; /** * Display a
My code is as below: Interpolation.h #ifndef INTERPOLATOR #define INTERPOLATOR #include <vector> #include <utility>
Part of the header file dlist.h is defined as: #ifndef __DLIST_H__ #define __DLIST_H__ #include
// stock.h #ifndef STOCK_H #define STOCK_H // declare Stock Class class Stock { private:
I have the following 3 files: error.h #ifndef error_h #define error_h #include <string> #include
I have the following seemingly innocuous piece of code: #ifndef UI_H #define UI_H #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.