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 7742935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:24:18+00:00 2026-06-01T09:24:18+00:00

I’m trying to write a small application and have come across a compile time

  • 0

I’m trying to write a small application and have come across a compile time error using auto_ptr.

I originally tired creating a smart pointer with class I created but the same error occurs if I try and create a smart pointer of type int so there must be something else I’m doing wrong. I was following the example given here..

I’ve got a feeling the answer to this will result in me slapping myself.

I declare the smart pointer at the bottom of this file.

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <memory.h>
#include <QMainWindow>
#include "dose_calac.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

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

private slots:
    /*
     Some QT stuff here, removed for clarity / size...
    */

private:
    Ui::MainWindow *ui;

    /*
      Object for storage of data and calculation of DOSE index score.
    */

    std::auto_ptr<int> pdoseIn(new int); // A simple set case, but sill produces an error!?!

    std::auto_ptr<DOSE_Calac> pdoseIn(new DOSE_Calac); // Original code, error found here at first.
};

#endif // MAINWINDOW_H

and this is my class, dose_calac.h.

#ifndef DOSE_CALAC_H
#define DOSE_CALAC_H

class DOSE_Calac
{
public:
// constructor
    DOSE_Calac();
// set and get functions live here, removed for clarity / size.

// function for caulating DOSE indexpoints
    int CalcDOSEPoints();
private:
    unsigned int dyspnoeaScale;
    unsigned int fev1;
    bool smoker;
    unsigned int anualExacerbations;
    unsigned int doseIndexPoints;

};

#endif // DOSE_CALAC_H

Any help or suggestion gratefully received.

  • 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-01T09:24:19+00:00Added an answer on June 1, 2026 at 9:24 am

    Your error is caused by including an incorrect header. Instead of

    #include <memory.h>
    

    you should write

    #include <memory>
    

    Also, there is more severe mistake in your class definition, because you cannot initialize class member in this way:

    std::auto_ptr<int> pdoseIn(new int);
    

    You have to, separately, declare it and initialize in the constructor:

    std::auto_ptr<int> pdoseIn;
    MainWindow()
        : pdoseIn(new int)
    {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small

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.