Note that there are some explanatory texts on larger screens.

plurals
  1. POQt and C++ class giving me an error
    primarykey
    data
    text
    <p>what am I doing wrong?</p> <pre><code>#ifndef MAINWINDOW_H #define MAINWINDOW_H #include &lt;QMainWindow&gt; #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 </code></pre> <p>When i try to compile and run the program, it says:</p> <pre><code>g:\ke\c++ projects\projects\qt\shitlencoder\mainwindow.h:18: error: C2079: 'MainWindow::FileController' uses undefined class 'FileOperations' </code></pre> <p>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.</p> <p>I'm using Qt 5.0.</p> <p>fileoperations.h:</p> <pre><code>#ifndef FILEOPERATIONS_H #define FILEOPERATIONS_H #include "ui_mainwindow.h" #include "mainwindow.h" #include &lt;QFileDialog&gt; #include &lt;string&gt; #include &lt;time.h&gt; #include &lt;iostream&gt; #include &lt;conio.h&gt; #include &lt;windows.h&gt; #include &lt;fstream&gt; 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&lt;int&gt; conbyte1; vector&lt;int&gt; conbyte2; vector&lt;int&gt; opbyte1; vector&lt;int&gt; opbyte2; vector&lt;int&gt; passwordbytes; }; #endif // FILEOPERATIONS_H </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload