Q:

Can't instantiate a pointer within main window class

The compiler wont let me instanciate fileprocessor *p; in mainwindow.ccp but I am able to in any other class.
mainwindow.cpp
   #include "mainwindow.h"
   #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
    {
        fileprocessor *p;
        ui->setupUi(this);
        QObject::connect(ui->Open, SIGNAL(clicked()),
                         this,SLOT(on_action_Open_triggered()));
    }

    MainWindow::~MainWindow()
    {
        delete ui;
    }

-mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFile>
#include <QFileDialog>
#include <QTextStream>
#include <QStandardItemModel>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

I am given fileprocessor:undeclared identifier and p: undeclared identifier

A:

@user4217633: Include fileprocessor.h in the mainwindow.cpp, not in mainwindow.h. There you need a forward declaration:
class fileprocessor; // Just this

You already have such a forward declaration, in fact:
namespace Ui {
  class MainWindow;
}

