Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • [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?



  • 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



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



  • 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.



  • 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



  • 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.



  • 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



  • 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



  • 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?



  • 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.



  • 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



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

    regards
    imrrk



  • [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.



  • 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



  • That info is also in my post...



  • 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



    • ../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).



  • 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



  • Perhaps you should use your debugging skills to find out why you have a linking error? There is more information to be found in the compilation output...



  • ok..but whether the code which i have sent you is correct and the whether the files which i have included in my pro file are correct?



  • Do yourself and all contributors here a favor and start from scratch. Your baby project does not need to be split up into a myriad of single subprojects including DLLs (you will not bother us with DLL, library and plugin errors, won't you?).

    Collect all the relevatn .cpp and .h files, put them into a single directory and make a single project out of it by writing a new .pro file from scratch.

    Sorry if I sound a bit rude, but from your knowledge of Qt in particular and C++ and development skills in general you are far far away from being able to manage project with subprojects.



  • [quote author="imrrk" date="1303815401"]ok..but whether the code which i have sent you is correct and the whether the files which i have included in my pro file are correct?[/quote]

    If you get a linking error, do you think what you have now is correct?



  • volker,i think many things will be new to everyone in this world,few things might be new to you also,and if i need to learn it i have to,i cant follow the alternate approach,if i will i can achieve it ,and i am not rude and angry on anyone,and and you masters can only help us beginners to become masters like you and I think by sharing knowledge only knowledge increase.`So I want to learn it and I will learn it

    thanks
    imrrk



  • no andre,I am just asking whether my approach is correct..

    regards
    imrrk



  • Did you find out what your linker error is about yet? What file or method is your linker complaining about?

    imrrk, as you have been told before, you're not an easy one to provide help to. You respond badly to suggestions, and show very, very little understanding of programming in general, programing in C++ in particular and of Qt especially, nor an inclination to do some research of your own. That is tiresome for people trying to help you, and takes away from the attention more advanced people on this forum can give to other people asking questions. I'm sure you have been referred to "this FAQ":http://www.catb.org/~esr/faqs/smart-questions.html before, but I will again. Please read it carefully. It may help you understand why people here sometimes get frustrated with the stream of questions that you post here (and in other places, I understand).



  • hello andre,I solved the error,thanks a lot,actually andre I am still a learner,and I aplogize if I have gone wrong in communicating..Now I am able to open a dialog present in another project on a button click.
    now similarly I tried to open a mainwindow.ui present in another project by the below code

    @void Dialog1::on_pushButton_2_clicked()
    {
    MainWindow *b=new MainWindow;
    b->showMaximized();
    }@
    and i succeed in opening the mainwindow,but the issue is that the size shrinks when it gets open,may i know the reason for this.

    regards
    imrrk



  • Hello friends,can any one tell me why i am getting the above problem that i have posted in above post..



  • Hey imrrk, you needn't post a reminder in the forum.
    If someone knows the answer, he /she will answer.

    And we are not sitting each second in font of DevNet :-)



  • oh sorry gerolf,i hope you might know this and please help me out.



  • the maindialog which i am calling contains a text box and button,and when i call it through a dialog,it gets open but layout changes,if the same thing if i did with dialog the layout wont change..



  • hello everyone ,through the discussion in this thread,i learnt an important aspect of integrating subprojects into one project,by creating a .pri file and including it into the main project.pro file and its work perfectly well and thank all the qt experts who helped me out in learning this,

    Now their is one more approach of integrating the subprojects i.e creating dll or static lib ,but I dont know this approch ,but i want to learn it,so qt experts ,please help me out

    regards
    imrrk



  • imrrk, please, don't write ping messages in 1.5 hours after your previous message. I've deleted it for now.



  • hello denis, sorry for that,please help me out



  • Hi imrrk,

    if someone reads the message, and can answer and has time, he will do, I'm sure. And if they have more questions for clarification, they will ask.

    And if you have some additional stuff to add after you last post, and there is no post in between, please use the edit link and edit your post.

    Thanks



  • hey gerolf ,you already know my problem so why dont you help me out..

    regards
    imrrk



  • OK, that's it. Closing pending discussion among moderators on how to deal with this. Note that I'll do the same to any new threads you try to open on this or on related issues, so I recommend you don't do that.

    Edit:
    There is consensus among moderators (and admins) that this thread will stay closed.


Log in to reply