Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. expected body of lambda expression
Forum Updated to NodeBB v4.3 + New Features

expected body of lambda expression

Scheduled Pinned Locked Moved Solved QML and Qt Quick
linuxlambdaqmlgccg++
4 Posts 2 Posters 5.0k Views 2 Watching
  • 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.
  • tansgumusT Offline
    tansgumusT Offline
    tansgumus
    wrote on last edited by tansgumus
    #1

    Hi,

    I'm working in integrating QML and C++ by applying this example but the parser says (unable to build the project too):

    error: expected body of lambda expression // points to  emit [ emit]  userNameChanged();
    

    Although I already included CONFIG += c++11 in my .pro file!

    How can I fix this issue?

    • OS: Linux Mint 19.1 xfce
    • GCC: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
    • G++: g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Can you show the actual code that gives this error?
      Looking at sample

      void BackEnd::setUserName(const QString &userName)
      {
          if (userName == m_userName)
              return;
      
          m_userName = userName;
          emit userNameChanged();
      }
      

      I see no lambdas or any cause for such error.

      1 Reply Last reply
      0
      • tansgumusT Offline
        tansgumusT Offline
        tansgumus
        wrote on last edited by
        #3

        silly me. I was playing with lambda so I forgot to remove the code.

        mrjjM 1 Reply Last reply
        1
        • tansgumusT tansgumus

          silly me. I was playing with lambda so I forgot to remove the code.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @tansgumus
          ah, so the [] part was left and
          it missed the actual body ? ( {})
          Well these things happens :)

          1 Reply Last reply
          0

          • Login

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