Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. no matching function for call to 'device::device()'
QtWS25 Last Chance

no matching function for call to 'device::device()'

Scheduled Pinned Locked Moved Solved General and Desktop
c++class
5 Posts 3 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wwwsharq
    wrote on last edited by
    #1

    let me premise by sayin i'm learning c++ and qt at the same time so please forgive me if it's an obvious error but i haven't been able to understand why i'm having problems with this.
    in main.ccp i use

    device dev;

    class MainWindow;

    // Class derived from stn_device, with required overrides.
    //
    class device : public stn::stn_device
    {
    public:
    device(MainWindow* wnd);
    bool is_sequence_finished()
    {
    return seq_finished;
    }

    // a lot of stuff
    private:
     MainWindow* owner;
       bool seq_finished{};
       int image_index();
     };
     in the stn_device header i have this declaration
     public:
          stn_device();                           ///< Constructs the instance in default state.
          virtual ~stn_device();                  ///< Releases all resources for device.
    
      stn_device& operator=(stn_device const&) = delete;
      stn_device(stn_device&& other) = delete;
    stn_device& operator=(stn_device&& other) = delete;
    

    is this enough to understand the issue? thank you in advance

    Ronel_qtmasterR Pl45m4P 2 Replies Last reply
    0
    • W wwwsharq

      let me premise by sayin i'm learning c++ and qt at the same time so please forgive me if it's an obvious error but i haven't been able to understand why i'm having problems with this.
      in main.ccp i use

      device dev;

      class MainWindow;

      // Class derived from stn_device, with required overrides.
      //
      class device : public stn::stn_device
      {
      public:
      device(MainWindow* wnd);
      bool is_sequence_finished()
      {
      return seq_finished;
      }

      // a lot of stuff
      private:
       MainWindow* owner;
         bool seq_finished{};
         int image_index();
       };
       in the stn_device header i have this declaration
       public:
            stn_device();                           ///< Constructs the instance in default state.
            virtual ~stn_device();                  ///< Releases all resources for device.
      
        stn_device& operator=(stn_device const&) = delete;
        stn_device(stn_device&& other) = delete;
      stn_device& operator=(stn_device&& other) = delete;
      

      is this enough to understand the issue? thank you in advance

      Ronel_qtmasterR Offline
      Ronel_qtmasterR Offline
      Ronel_qtmaster
      wrote on last edited by Ronel_qtmaster
      #2

      @wwwsharq it seems that your class device does not have any constructor

      1 Reply Last reply
      0
      • W wwwsharq

        let me premise by sayin i'm learning c++ and qt at the same time so please forgive me if it's an obvious error but i haven't been able to understand why i'm having problems with this.
        in main.ccp i use

        device dev;

        class MainWindow;

        // Class derived from stn_device, with required overrides.
        //
        class device : public stn::stn_device
        {
        public:
        device(MainWindow* wnd);
        bool is_sequence_finished()
        {
        return seq_finished;
        }

        // a lot of stuff
        private:
         MainWindow* owner;
           bool seq_finished{};
           int image_index();
         };
         in the stn_device header i have this declaration
         public:
              stn_device();                           ///< Constructs the instance in default state.
              virtual ~stn_device();                  ///< Releases all resources for device.
        
          stn_device& operator=(stn_device const&) = delete;
          stn_device(stn_device&& other) = delete;
        stn_device& operator=(stn_device&& other) = delete;
        

        is this enough to understand the issue? thank you in advance

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by Pl45m4
        #3

        @wwwsharq said in no matching function for call to 'device::device()':

        device dev;

        If this is your code in main.cpp and below that your class code, then you need to call the correct constructor or implement the one you've used.
        As the error message says, you don't have a default c'tor to match your call. You only have one implemented which expects a MainWindow as argument.

        @Ronel_qtmaster said in no matching function for call to 'device::device()':

        it seems that your class device does not have any constructor

        "Not any" is not correct, but not the right one :)


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        Ronel_qtmasterR 1 Reply Last reply
        1
        • Pl45m4P Pl45m4

          @wwwsharq said in no matching function for call to 'device::device()':

          device dev;

          If this is your code in main.cpp and below that your class code, then you need to call the correct constructor or implement the one you've used.
          As the error message says, you don't have a default c'tor to match your call. You only have one implemented which expects a MainWindow as argument.

          @Ronel_qtmaster said in no matching function for call to 'device::device()':

          it seems that your class device does not have any constructor

          "Not any" is not correct, but not the right one :)

          Ronel_qtmasterR Offline
          Ronel_qtmasterR Offline
          Ronel_qtmaster
          wrote on last edited by
          #4

          @Pl45m4 yes he is not using the constructor with Mainwindow as an argument.He declared it but did not implement

          W 1 Reply Last reply
          1
          • Ronel_qtmasterR Ronel_qtmaster

            @Pl45m4 yes he is not using the constructor with Mainwindow as an argument.He declared it but did not implement

            W Offline
            W Offline
            wwwsharq
            wrote on last edited by
            #5

            @Ronel_qtmaster
            oh i understood what i wasn't getting yeah idk why i did that, thanks!
            onto the next mistake....

            1 Reply Last reply
            0
            • SGaistS SGaist has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved