Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt5 GUI and RF24 lib
Forum Updated to NodeBB v4.3 + New Features

Qt5 GUI and RF24 lib

Scheduled Pinned Locked Moved Solved Mobile and Embedded
14 Posts 3 Posters 1.4k 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.
  • C Csaba911

    Beginner with Linux and Qt (lest than 2 day expertise :)
    Raspberry with NRF24l01 radio works fine using https://github.com/nRF24/RF24 with standard C++ and Python.
    I would like to make a gui app with Qt and use this excellent lib with it.

    Now I stuck right in the beginning
    #include <RF24/RF24.h> //lib found fine
    RF24 *radio; //created radio
    radio = new RF24(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_4MHZ); //trying to int radio and not found reference to it.

    Error undefined reference to `RF24::RF24(unsigned short, unsigned short, unsigned int)' RF4 D:\PiProjects\RF4\RF4\RF4.cpp 23

    Please advise how start with it.
    TY

    Pablo J. RoginaP Offline
    Pablo J. RoginaP Offline
    Pablo J. Rogina
    wrote on last edited by
    #2

    @csaba911 it looks like you need to set the LIBS variable in your .pro file. See documentation

    Upvote the answer(s) that helped you solve the issue
    Use "Topic Tools" button to mark your post as Solved
    Add screenshots via postimage.org
    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

    C 1 Reply Last reply
    1
    • Pablo J. RoginaP Pablo J. Rogina

      @csaba911 it looks like you need to set the LIBS variable in your .pro file. See documentation

      C Offline
      C Offline
      Csaba911
      wrote on last edited by
      #3

      @pablo-j-rogina Being inexperienced as I’m need help with that too.
      Tried to add Qt +=RF24 but that was a instant error.

      Pablo J. RoginaP 1 Reply Last reply
      0
      • C Csaba911

        @pablo-j-rogina Being inexperienced as I’m need help with that too.
        Tried to add Qt +=RF24 but that was a instant error.

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #4

        @csaba911 yeah, you probably will face several issues... It's like you're learning how to swim in a pond but you immediately want to cross the English Channel.

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        C 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi and welcome to devnet,

          Please re-read the documentation @Pablo-J-Rogina linked to. It's the exact part you need add to your pro file.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Pablo J. RoginaP Pablo J. Rogina

            @csaba911 yeah, you probably will face several issues... It's like you're learning how to swim in a pond but you immediately want to cross the English Channel.

            C Offline
            C Offline
            Csaba911
            wrote on last edited by
            #6

            @pablo-j-rogina I can swim just fine (not in Qt water) this isn’t a rocket science I’m expecting it to be a short 100 line program so not the “English channel”
            Can you just give me a example how do you reference a external lib like RF24.
            Ty

            Pablo J. RoginaP 1 Reply Last reply
            0
            • C Csaba911

              @pablo-j-rogina I can swim just fine (not in Qt water) this isn’t a rocket science I’m expecting it to be a short 100 line program so not the “English channel”
              Can you just give me a example how do you reference a external lib like RF24.
              Ty

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #7

              @csaba911 said in Qt5 GUI and RF24 lib:

              I can swim just fine

              I don't doubt that...

              (not in Qt water)

              That's exactly my point

              Can you just give me a example how do you reference a external lib like RF24.

              I've already pointed you to the proper documentation, and @SGaist suggested to re-read it, confirming it's a good lead. So I'm done here.

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              C 1 Reply Last reply
              0
              • C Offline
                C Offline
                Csaba911
                wrote on last edited by Csaba911
                #8

                Added LIBS += -L/usr/local/lib -llibrf24 to debug.pro still getting the same error.

                g++ -o Debug/RF5 Debug/RF5.o Debug/MainWindow.o Debug/moc_MainWindow.o -L/usr/local/lib -llibrf24 -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lpthread -latomic
                1> /usr/bin/ld: cannot find -llibrf24
                1>collect2 : error : ld returned 1 exit status
                1> make: *** [Makefile:165: Debug/RF5] Error 1

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Csaba911
                  wrote on last edited by Csaba911
                  #9

                  Confirmed that lib are installed
                  make: Nothing to be done for 'all'.
                  [Installing Libs to /usr/local/lib]
                  [Installing Headers to /usr/local/include/RF24]
                  make: Nothing to be done for 'all'.

                  ldconfig -p | grep librf24
                  librf24.so.1 (libc6,hard-float) => /usr/local/lib/librf24.so.1
                  librf24.so (libc6,hard-float) => /usr/local/lib/librf24.so

                  So can you please help[ me to add whatever needed to be included ] !? or at least what file dir need for it ? Might not even work with Qt5 and we just wasting time.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    It has nothing to do with Qt.

                    When linking to a library, remove the lib part of your library name. For example, when linking against zlib, the line is:

                    LIBS += -lz
                    

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    C 1 Reply Last reply
                    2
                    • SGaistS SGaist

                      It has nothing to do with Qt.

                      When linking to a library, remove the lib part of your library name. For example, when linking against zlib, the line is:

                      LIBS += -lz
                      
                      C Offline
                      C Offline
                      Csaba911
                      wrote on last edited by
                      #11

                      @sgaist Thanks its working now, at least compile without error.

                      C 1 Reply Last reply
                      0
                      • C Csaba911

                        @sgaist Thanks its working now, at least compile without error.

                        C Offline
                        C Offline
                        Csaba911
                        wrote on last edited by
                        #12

                        @csaba911 And its done (for now)
                        153 line, init RF24 radio, connect to remote, request data, display data.
                        Thanks again @SGaist

                        1 Reply Last reply
                        0
                        • Pablo J. RoginaP Pablo J. Rogina

                          @csaba911 said in Qt5 GUI and RF24 lib:

                          I can swim just fine

                          I don't doubt that...

                          (not in Qt water)

                          That's exactly my point

                          Can you just give me a example how do you reference a external lib like RF24.

                          I've already pointed you to the proper documentation, and @SGaist suggested to re-read it, confirming it's a good lead. So I'm done here.

                          C Offline
                          C Offline
                          Csaba911
                          wrote on last edited by
                          #13

                          @pablo-j-rogina you see after reading the lib section of the manual again I still don’t see any references that don’t add lib to librf24 ,that document assuming that I know that ?
                          “LIBS += -L/usr/local/lib -lmath” the library called libmath than it would be obvious to remove lib from it.
                          Thanks.

                          Pablo J. RoginaP 1 Reply Last reply
                          0
                          • C Csaba911

                            @pablo-j-rogina you see after reading the lib section of the manual again I still don’t see any references that don’t add lib to librf24 ,that document assuming that I know that ?
                            “LIBS += -L/usr/local/lib -lmath” the library called libmath than it would be obvious to remove lib from it.
                            Thanks.

                            Pablo J. RoginaP Offline
                            Pablo J. RoginaP Offline
                            Pablo J. Rogina
                            wrote on last edited by
                            #14

                            @csaba911 said in Qt5 GUI and RF24 lib:

                            don’t add lib to librf24

                            Well, you said before you're good on other waters...

                            That feature is a common practice since a long ago, see GCC documentation for instance:

                            -llibrary
                            ...
                            Some targets also support shared libraries, which typically have names like liblibrary.so.

                            It's even used in the Makefiles of the RF24 project you use

                            LIBS+= -llittlewire-spi

                            Anyway, glad you have it working. And please don't forget to mark this post as solved, it might help other users. Thanks

                            Upvote the answer(s) that helped you solve the issue
                            Use "Topic Tools" button to mark your post as Solved
                            Add screenshots via postimage.org
                            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                            1 Reply Last reply
                            1

                            • Login

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