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. Adding lib files and their paths in .pro file [Closed]
Forum Updated to NodeBB v4.3 + New Features

Adding lib files and their paths in .pro file [Closed]

Scheduled Pinned Locked Moved Mobile and Embedded
49 Posts 7 Posters 28.4k Views 1 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.
  • I Offline
    I Offline
    imrrk
    wrote on last edited by
    #12

    Actually i hv one pushButton in different project file and on the click of push button it should refer to a Mainwindow which is present in another project file..i created the lib file of one project say test.pro in the below way..
    @
    TEMPLATE=lib
    CONFIG+=dll
    @
    After writing this code in test.pro file and when i build it..i get two files test.a and test.dll in test-buildsimulator folder..

    Now i added this path of the lib file in my test1.pro file in the following way....

    @
    win32:
    {
    LIBS += -L../test-build-simulator/debug
    }
    LIBS += -ltest
    }
    @
    wether i am proceeding correctly....

    [edit: code highlighted with @ tags / Denis Kormalev]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #13

      Then your push button should be connected to a signal of your dialog. your dialog is exported so you can connect to it from outside the lib. The push button is not accessible from outside.

      This is a normal C++ issue, hide members from being used from outside of the class.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leon.anavi
        wrote on last edited by
        #14

        [quote author="imrrk" date="1303796480"]thanks leon ,but i want to know how to create a lib file of my project[/quote]

        I think you are on the right way as you have already started to rework the project. For hints regarding dynamic library you can also check "this thread":http://developer.qt.nokia.com/forums/viewthread/5204/

        [quote author="imrrk" date="1303802132"]
        @
        win32:
        {
        LIBS += -L../test-build-simulator/debug
        }
        LIBS += -ltest
        }
        @
        wether i am proceeding correctly....
        [/quote]

        I am just wondering which is your target platform because here I see win32 and the thread is in Mobile and Embedded section?

        http://anavi.org/

        1 Reply Last reply
        0
        • I Offline
          I Offline
          imrrk
          wrote on last edited by
          #15

          hi leon ,i am working for symbian device..only and whether we should include these lines ?
          and hey please help me about the pushbutton issue

          1 Reply Last reply
          0
          • I Offline
            I Offline
            imrrk
            wrote on last edited by
            #16

            hey gerolf,i am not getting you..........

            1 Reply Last reply
            0
            • L Offline
              L Offline
              leon.anavi
              wrote on last edited by
              #17

              Hi imrrk,

              For Symbian specific things use symbian at the .pro file.

              In this case it is highly recommended to a look at this article at Forum Nokia about "shared libraries on Qt for Symbian":http://wiki.forum.nokia.com/index.php/Shared_Library_DLLs_on_Qt_for_Symbian

              If you are planning to develop commercial software please note the remarks about UID and Symbian Signed - you might need to sign your DLL too!

              P.S.
              Please try to avoid spam and combine your message in a single post or edit existing post when it is possible.

              http://anavi.org/

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #18

                Hi imrrk,

                you should design a clean dialog.

                So your dialog might have custom signals-. How they are emitted does not matter to the user of the dialog, also not which widgets are placed on it. The signal can be emitted when the push butrton is pressed.

                @
                MyDialog::MyxDialog()
                {
                UI = new ...
                ui->setupUI(this);

                connect(ui->button, SIGNAL(clicked()), this, SIGNAL(myClickedSignal()))
                

                }
                @

                This is pseudo code, not build, not tested

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #19

                  Note that this topic has been explained more than once already. Like in "this":http://developer.qt.nokia.com/forums/viewthread/5144/ thread. Your case is not so different, so learn from the answers that are already there first.

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    imrrk
                    wrote on last edited by
                    #20

                    hi Gerolf

                    Actually my dialog where i have a pushbutton is in one project file and the dialog which i want to connect it through this pushbutton is in another project file and both project files are in seperated folder,i.e i have created one project file and my friend has created another project file,so i want to integrate these two diffrent projects

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      imrrk
                      wrote on last edited by
                      #21

                      hello andre,I have two different prjects and am trying to integrate these projects,such has on click of pushbutton in my one project it should open a dialog which is present in another project so that it can be solved in a modular way..

                      regards
                      imrrk

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on last edited by
                        #22

                        Imrrk,

                        did you read the posts?

                        Create a signal in the exported dialog, which is triggered by the button.

                        use this signal for your actions.

                        Anything unclear with this statement?

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          andre
                          wrote on last edited by
                          #23

                          There are several ways to do this. Do you want a full-fledged library, or just use different .pro files for your components? I use the second way frequently.

                          Instead of using a .pro file, I use a .pri file. They are the same format, but a .pri file is semantically different. It does not describe a complete project, it only describes what is needed for a single component that I may use in several projects. A typical .pri file might look like this for me:

                          @
                          SOURCES *= src/fileselector.cpp
                          HEADERS *= src/fileselector.h
                          FORMS *= ui/fileSelectorUI.ui
                          @

                          Then, in the project where I want to use this component, I have this in the .pro file (along with everything else that needs to be in the .pro file to make it a complete project, of course):

                          @
                          VPATH = ../common/
                          INCLUDEPATH += ../common/src/

                          include(../common/fileselector.pri)
                          @

                          In my source, where I use this component, I then only need to do this:
                          @
                          #include "fileselector.h"
                          @

                          and I can access everything I need from the FileSelector component. I am currently using this pattern for about 30 components that I use across 10 or so applications, so I can vouch for this method working.

                          A downside to this method is that if you change something in a component, you need to re-compile all the applications that use that component. Also, each component is re-compiled for every application. If you put the component in a real library, you only need to compile it once when it changes. Also, if you have several of these different applications sharing the same components open at the same time, you can share the memory needed for them.

                          1 Reply Last reply
                          0
                          • I Offline
                            I Offline
                            imrrk
                            wrote on last edited by
                            #24

                            hey gerolf,I am sorry but if you r with me,we will go from first,
                            now I have created freshly two projects and named as test1 and test2.which contains nothing.

                            now tell me what is my first step and whether i have to create lib file?I will go as per your instructions,

                            regards
                            imrrk

                            1 Reply Last reply
                            0
                            • I Offline
                              I Offline
                              imrrk
                              wrote on last edited by
                              #25

                              hello andre how shall i create a .pri file,I dont have any idea about this..so please explain me..

                              regards
                              imrrk

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                andre
                                wrote on last edited by
                                #26

                                [quote author="imrrk" date="1303810544"]hello andre how shall i create a .pri file,I dont have any idea about this..so please explain me..[/quote]

                                Exactly the same way you would construct a .pro file. In your editor. It is just a text file after all.

                                1 Reply Last reply
                                0
                                • I Offline
                                  I Offline
                                  imrrk
                                  wrote on last edited by
                                  #27

                                  hey andre i have created a .pri file as per your instructions,my test11.pri looks like below
                                  @SOURCES *= dialog.cpp
                                  HEADERS *= dialog.h
                                  FORMS *= dialog.ui@
                                  now in your above post u said to add these in my main project ie. test2.pro file..so how shall i include it according to you

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    andre
                                    wrote on last edited by
                                    #28

                                    That info is also in my post...

                                    1 Reply Last reply
                                    0
                                    • I Offline
                                      I Offline
                                      imrrk
                                      wrote on last edited by
                                      #29

                                      yes andre,but i am not understanding it..actually you have given this

                                      @VPATH = ../common/
                                      INCLUDEPATH += ../common/src/

                                      include(../common/fileselector.pri)
                                      @
                                      but i want to know what to include in VPATH,INCLUDEPATH and include

                                      regards
                                      imrrk

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        andre
                                        wrote on last edited by
                                        #30
                                        • ../common/ is the directory where all my .pri files are. You need this to have qmake find your source files.
                                        • ../common/src is the directory where all the source and header files for my components are. You need that to be able to #include them.
                                        • the include statement actually pulls in the contents of the .pri file into the .pro file.

                                        So, what you put where, depends on where your components are in your file structure. In my case, I have something like this as my root structure:

                                        @
                                        common
                                        common/src
                                        common/ui
                                        common/resources
                                        project1
                                        project1/src
                                        project2
                                        project2/src
                                        project2/ui
                                        project2/resources
                                        @
                                        etc. The .pri files are in the directory common, while the .pro files are in the different project directories (project1 and project2).

                                        1 Reply Last reply
                                        0
                                        • I Offline
                                          I Offline
                                          imrrk
                                          wrote on last edited by
                                          #31

                                          ok andre i got your point and i have included in my main project i.e test2.pro file the below lines
                                          @INCLUDEPATH += ../test11
                                          include(../test11.pri)@

                                          and in my main project ie test2,i have dialog1.cpp and i have include this code
                                          @#include "dialog1.h"
                                          #include "ui_dialog1.h"

                                          #include "dialog.h"//this is from my previous project test11

                                          Dialog1::Dialog1(QWidget *parent) :
                                          QDialog(parent),
                                          ui(new Ui::Dialog1)
                                          {
                                          ui->setupUi(this);
                                          }

                                          Dialog1::~Dialog1()
                                          {
                                          delete ui;
                                          }

                                          void Dialog1::on_pushButton_clicked()
                                          {
                                          Dialog a(this);
                                          a.show();
                                          a.exec();
                                          }@
                                          now only one error i am getting
                                          bq. :: error: collect2: ld returned 1 exit status

                                          whether i am on the right track?

                                          regards
                                          imrrk

                                          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