PDA

View Full Version : How to reuse qmake/make compiled files (.o moc*.o) ? Can it be possible ?



tonnot
23rd March 2011, 19:56
I explain it.
I have a project with some ui's and some classes, this one uses MYDLL classes.
I have another project with the same ui's and classes, but I uses the 'dll' classes directly, using a .pri file who has the correct headers and sources.
( I use this way to test the functions of my dll classes without compile the whole dll)

Ok, everytime I compile the project A or project B, I see Myproject1_buil_desktop and Myproject2_build_desktop. I think.... maybe I'm loosing my time because the moc and .o files are the same files ?
How can I describe the both .pro files to use the .o and moc_*.o files ?
(Maybe it does not can be possible)
I expect I have explained my doubt.
Thanks

wysota
23rd March 2011, 21:29
maybe I'm loosing my time because the moc and .o files are the same files ?
Maybe they are not?


How can I describe the both .pro files to use the .o and moc_*.o files ?
You can create a third project and build all the shared files into a static library and link this library from your remaining two projects.

tonnot
24th March 2011, 09:23
Thanks wy.
I know I can build a dll, but I'm talking about the files used to have the GUI.
I have two projects projectA and projectB, one of them are using 'myclasses' throught a DLL, the other uses them directly. I know I cant do anything with the dll elements, but whats about the 'main' files of all gui of my project? This gui is compounded by a few ui files (that are builded trought its .h and .cpp files ). I see moc_files*.o and files*.o in both folders projectA_build_desktop/release and projectB_build_destop/release.
So the question is 'Can I do something to get some advantage of using the same .o files? (I imagine that compile times are going to be lower) How?
Thanks

wysota
24th March 2011, 10:10
I know I can build a dll
I didn't say anything about a dll. I gave you a precise answer to your question.