How to fix this error in my code?

I wrote sourcecode for creating a DLL(called it AppEx.dll) and currently my AppEx.h looks like this

#pragma once
#include "stdafx.h"
#include "iostream"

#define _APPEX_API_ __declspec(dllexport)
#define _APPEX_API_ __declspec(dllimport)
using namespace std;

class _APPEX_API_ delay {

    void setdelay(int);
    int getdelay();
    bool isnull();
    delay& operator = (const int&);

    int amount;

class _APPEX_API_ ex_ostream : public ostream {

    ex_ostream& operator<< (delay&);
    ex_ostream& operator<< (const char*);

    bool do_delay;
    int amount;
};                        // this is line 36, here occurs the error

and here is my AppEx.cpp

#include "stdafx.h"
#include "AppEx.h"

delay::delay() {
    this->amount = NULL;

void delay::setdelay(int amount) {
    if (amount > 0) this->amount = amount;
    else this->amount = NULL;

int delay::getdelay() {
    return this->amount;

bool delay::isnull() {  
    if (this->amount) return true;
    else return false;

delay& delay::operator = (const int& amount) {
    if (amount > 0) this->amount = amount;
    else this->amount = NULL;
    return *this;

ex_ostream::ex_ostream() : ostream(cout.rdbuf()) {
    this->do_delay = false;
    this->amount = 0;

ex_ostream& ex_ostream::operator << (delay& wait) {
    this->do_delay = true;
    this->amount = wait.getdelay();
    return *this;

ex_ostream& ex_ostream::operator << (const char* str) {
    if (this->do_delay) {
        int index = 0;
        while (str[index] != '') {
            *this << str[index];
    else {
        *this << str;
    return *this;

Here is the error I get, I read that I could fix that by using call-by-reference but using that didn’t help and I have no idea why I am refering to a “deleted function” but anyway here is the error 😀

Error C2280 
 std::basic_ios<char,std::char_traits<char>> &)': 

 attempting to reference a deleted function

 c:usersalexdocumentsvisual studio 2015projectsappexappex  

 Line: 36    File: AppEx.h

As always thank you for reading <3 and please help me with this 😀 It seems to be a pretty complex problem for me xD

Source: dll

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.