generate a library and use it in a project
-
Hello,
I am new to Qt. I am facing a problem to do a task.
Well, I have a .cpp file and its header. I would like to build them using the .pro and .pri files and than, I need to use this library in my project.
Well, I don't know how to build it and how to call it in the .pri file of the project. Can anyone help me? -
So it is a requirement that those .cpp and .h is not compiled with the project?
If yes ( even i dont understand why excatly )
then surely a library is the way to go.
You can then compile it once and then only link the so/dll to the app. -
Hi And welcome to the forums
This tut shows how to make a lib and use it
https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_applicationThat said, you do need a basic understanding of dlls/so files and linking and such.
But else just ask here. Good questions get good answers.
Also since you talk about a pri file. Are you sure you want it as a library as using a pri file sounds a bit more like a sub project.
Both can do the same but using a pri file is vastly easier than making a lib and linking to that. :) -
Hello, thank you for your response. In fact, I have a .cpp filee and its header that musn't be included in the project and these files are required to be used in some modules of the project. If I create a library with the needed file and I link my project to this lib will I be in the right path?
-
So it is a requirement that those .cpp and .h is not compiled with the project?
If yes ( even i dont understand why excatly )
then surely a library is the way to go.
You can then compile it once and then only link the so/dll to the app. -
@Rouja
yes the link i showed
https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_applicationit also shows how to load the library and resolve symbols meaning
how to use it / call functions in it and so on.