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. how to link the object file to a Qt

how to link the object file to a Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.9k 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.
  • A Offline
    A Offline
    Asha
    wrote on 18 Sept 2019, 11:23 last edited by
    #1

    Hi,

    I wrote one simple code in terminal
    vi test.c
    which displays "Hi"

    compiled that test.c file with the help of cross compiler,"arm-linux-gnueabihf-gcc" and generated a object file.

    next I copied that object file into my beagleboneboard,using

    scp test debian@192.168.7.2:/test

    now I want to link this object file which is present in beagleboneboard into Qt,

    is it possible to link this object file to Qt? if yes,
    then please suggest me how to link ,what are the steps to link that object file in to Qt?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 18 Sept 2019, 14:06 last edited by mrjj
      #2

      Hi
      In your Qt project file on the beagleboneboard, add
      LIBS += THEFILE.o
      and make sure that the .o file is in the project folder.

      This assumes that its the same compiler on the board as the one
      that produced the .o file.
      Wildly variation in compiler versions might prevent it from working.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asha
        wrote on 19 Sept 2019, 04:43 last edited by
        #3

        Hi,

        "In your Qt project file on the beagleboneboard, add
        LIBS += THEFILE.o"

        It means I have to add that LIBS +=file.o to my beagleboard test file(executable file)?

        0_1568868010339_BBB.png

        0_1568868038177_exe (1).png

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 19 Sept 2019, 07:56 last edited by mrjj
          #4

          Hi
          you must add it to the project on the board so you can compile the .-o into your new exe file.
          if you try to like add an o file to binary exe, that wont work.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Asha
            wrote on 19 Sept 2019, 08:21 last edited by
            #5

            Sorry,

            But I am not getting this
            "you must add it to the project on the board"(in board I have only one executable file,that is test)

            I need to add it on my qt project file in my system?

            M 1 Reply Last reply 19 Sept 2019, 11:38
            0
            • A Asha
              19 Sept 2019, 08:21

              Sorry,

              But I am not getting this
              "you must add it to the project on the board"(in board I have only one executable file,that is test)

              I need to add it on my qt project file in my system?

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 19 Sept 2019, 11:38 last edited by
              #6

              @asha
              Hi
              You need need to add it to the .pro file that produces the Qt application.
              So it can be linked into the new exe file.

              You can not added to an already compiled app.

              So you need to add the .o to the project file for the app, where you want to include the .o file.

              A 1 Reply Last reply 22 Oct 2019, 06:36
              2
              • M mrjj
                19 Sept 2019, 11:38

                @asha
                Hi
                You need need to add it to the .pro file that produces the Qt application.
                So it can be linked into the new exe file.

                You can not added to an already compiled app.

                So you need to add the .o to the project file for the app, where you want to include the .o file.

                A Offline
                A Offline
                Asha
                wrote on 22 Oct 2019, 06:36 last edited by
                #7

                @mrjj

                Hi,

                I am running the application on qt,but not getting the output on qt creator app,

                the result i am getting on vnc platform,via command prompt..

                so I created .pro file in command prompt,and linked the object file(c++ object file),while executing this object file getting the result in command prompt ,not in vnc platform...

                so my question is, is it possible to link the cpp files to qt projects? if yes, how?

                the cpp file is:

                #include <iostream>
                using namespace std;
                int main()
                {
                cout<<"Hello World";

                return 0;
                }

                M 1 Reply Last reply 22 Oct 2019, 07:59
                0
                • A Asha
                  22 Oct 2019, 06:36

                  @mrjj

                  Hi,

                  I am running the application on qt,but not getting the output on qt creator app,

                  the result i am getting on vnc platform,via command prompt..

                  so I created .pro file in command prompt,and linked the object file(c++ object file),while executing this object file getting the result in command prompt ,not in vnc platform...

                  so my question is, is it possible to link the cpp files to qt projects? if yes, how?

                  the cpp file is:

                  #include <iostream>
                  using namespace std;
                  int main()
                  {
                  cout<<"Hello World";

                  return 0;
                  }

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 22 Oct 2019, 07:59 last edited by
                  #8

                  @Asha
                  Hi
                  You can just include the wanted .cpp in the .pro file or
                  make file or what you use to compile. You can also link it into the porject as an .o file. However, if you have a main in the new .cpp that wont work as
                  there already is a main for the qt app.

                  Im not sure what you mean by
                  "while executing this object file getting the result in command prompt ,not in vnc platform.."

                  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