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 viable overloaded '=' for QDateTime

no viable overloaded '=' for QDateTime

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 959 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.
  • jasonlcy3J Offline
    jasonlcy3J Offline
    jasonlcy3
    wrote on last edited by
    #1

    How can I use a local variable in a lambda?

    test.cpp:17:18: error: no viable overloaded '='
    qdatetime.h:310:16: note: candidate function not viable: 'this' argument has type 'const QDateTime', but method is not marked const
    qdatetime.h:311:16: note: candidate function not viable: 'this' argument has type 'const QDateTime', but method is not marked const
    

    ac2fc1e5-71c3-4c46-a489-768a3e7790b8-image.png

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Apart from the fact that the rest is completely wrong, according to the c++ standard the captured objects are const inside the lambda

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

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