So, I have this class inside a namespace but when i try to create an instance i get the following error message:
#ifndef FILE_H
#define FILE_H
#include "constants.h"
#include <cstdlib>
#include <QVector>
namespace Compressor {
class File;
}
class File {
public:
QVector<QVector<int>> bytes;
int length;
public:
File(int l);
};
#endif // FILE_H
...
#include "file.h"
File::File(int l) {
length = l;
for(int i = 0; i < length; i++) {
QVector<int> b;
for(int j = 0; j < BYTESIZE; j++)
b.push_back(rand( ) % 2);
bytes.push_back( b );
}
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
...
#include "file.h"
#include "tableconfig.h"
#include "tableshow.h"
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
Compressor::File *fl;
//...
//...
...
void MainWindow::on_buttonOrigin_clicked( ) {
fl = new Compressor::File( ui->spinBox->value( ) ); // The problem happens here.
showBytesTable(ui->tableOrigin, fl);
}
Here the error message:
/home/roger/Programming/C-C++/Linux/Qt/Compressor-4bits/mainwindow.cpp:13: error: invalid use of incomplete type ‘class Compressor::File’ fl = new Compressor::File( ui->spinBox->value( ) ); ^
How can I fix that?