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 25 Mar 2024, 15:17 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

    R P 2 Replies Last reply 25 Mar 2024, 15:21
    0
    • W wwwsharq
      25 Mar 2024, 15:17

      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

      R Offline
      R Offline
      Ronel_qtmaster
      wrote on 25 Mar 2024, 15:21 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
        25 Mar 2024, 15:17

        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

        P Offline
        P Offline
        Pl45m4
        wrote on 25 Mar 2024, 16:01 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

        R 1 Reply Last reply 25 Mar 2024, 16:06
        1
        • P Pl45m4
          25 Mar 2024, 16:01

          @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 :)

          R Offline
          R Offline
          Ronel_qtmaster
          wrote on 25 Mar 2024, 16:06 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 26 Mar 2024, 12:47
          1
          • R Ronel_qtmaster
            25 Mar 2024, 16:06

            @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 26 Mar 2024, 12:47 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
            • S SGaist has marked this topic as solved on 26 Mar 2024, 20:04

            5/5

            26 Mar 2024, 12:47

            • Login

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