Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, May 2003
moc_file.cpp or file.moc ?


Message 1 in thread

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What is best, to compile moc_file.cpps or include file.mocs ? why ?
Thanks.
- -- 
Pupeno: pupeno@pupeno.com
http://www.pupeno.com
- ---
Help the hungry children of Argentina,
please go to (and make it your homepage):
http://www.porloschicos.com/servlet/PorLosChicos?comando=donar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+sCTaLr8z5XzmSDQRAhS3AJ9l+kdL8FpfWh3A4aVySHpi7up2LwCfX6A5
h1LzEwqR+Scc5v1tGDxh+T4=
=2ZyU
-----END PGP SIGNATURE-----


Message 2 in thread

On Wednesday April 30 2003 12:32 pm, Pupeno wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> What is best, to compile moc_file.cpps or include file.mocs ? why ?
> Thanks.

I think it's best to use tmake/qmake.... and not to #include .moc files 
because then you can use MOC_DIR option in your .pro file, and keep the 
object files out of the source tree. Keeps it cleaner, easier to see source 
there, and easier to have multiple platforms compiled.



-- 
 [ signature omitted ] 

Message 3 in thread

On Mon, 5 May 2003, ljp wrote:

> On Wednesday April 30 2003 12:32 pm, Pupeno wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > What is best, to compile moc_file.cpps or include file.mocs ? why ?
> > Thanks.
> 
> I think it's best to use tmake/qmake.... and not to #include .moc files 
> because then you can use MOC_DIR option in your .pro file, and keep the 
> object files out of the source tree. Keeps it cleaner, easier to see source 
> there, and easier to have multiple platforms compiled.

You can keep the .moc files in a seperate directory *and* include them
when compiling. Should give you a shorter overall build time, also a
slightly smaller binary.

Harri.


Message 4 in thread

Harri Porten wrote:

 > You can keep the .moc files in a seperate directory *and* include them
 > when compiling. Should give you a shorter overall build time, also a
 > slightly smaller binary.

Btw, is it possible to write dependencies in .pro files if I want to
#include .moc files in my code? Does moc have any option for this?

-- 
 [ signature omitted ] 

Message 5 in thread

On Mon, 5 May 2003, Jaroslaw Staniek wrote:

> Harri Porten wrote:
> 
>  > You can keep the .moc files in a seperate directory *and* include them
>  > when compiling. Should give you a shorter overall build time, also a
>  > slightly smaller binary.
> 
> Btw, is it possible to write dependencies in .pro files if I want to
> #include .moc files in my code? Does moc have any option for this?

qmake deals with the dependencies if you have included a .moc file in a
.cpp file. At least the latest version does so.

Harri.


Message 6 in thread

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 06 May 2003 10:28, Harri Porten wrote:
> On Mon, 5 May 2003, Jaroslaw Staniek wrote:
> > Harri Porten wrote:
> >  > You can keep the .moc files in a seperate directory *and* include them
> >  > when compiling. Should give you a shorter overall build time, also a
> >  > slightly smaller binary.
> >
> > Btw, is it possible to write dependencies in .pro files if I want to
> > #include .moc files in my code? Does moc have any option for this?
>
> qmake deals with the dependencies if you have included a .moc file in a
> .cpp file. At least the latest version does so.

Using qt 3.1.2 I simple included the moc file (file.moc from file.cpp, right 
?), I run qmake and then make and all I've got was a file.cpp:111:24: 
file.moc: No such file or directory.
Any idea ?
- -- 
Pupeno: pupeno@pupeno.com
http://www.pupeno.com
- ---
Help the hungry children of Argentina,
please go to (and make it your homepage):
http://www.porloschicos.com/servlet/PorLosChicos?comando=donar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+t8CDLr8z5XzmSDQRAlJ6AKDWwc90Msavfluq+7iHa5CKXziv9wCgzGKb
bZs8tWXcNpYjH0mW+MCBZWk=
=hGvT
-----END PGP SIGNATURE-----


Message 7 in thread

On Tue, 6 May 2003, Pupeno wrote:

> Using qt 3.1.2 I simple included the moc file (file.moc from file.cpp, right 
> ?), I run qmake and then make and all I've got was a file.cpp:111:24: 
> file.moc: No such file or directory.
> Any idea ?

Do you have file.h in the HEADERS list ?

Could be that we have some confusion with moc'ing .h vs. .cpp files here,
though. Don't recall the initial posters intention.

Harri.


Message 8 in thread

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 06 May 2003 13:10, Harri Porten wrote:
> On Tue, 6 May 2003, Pupeno wrote:
> > Using qt 3.1.2 I simple included the moc file (file.moc from file.cpp,
> > right ?), I run qmake and then make and all I've got was a
> > file.cpp:111:24: file.moc: No such file or directory.
> > Any idea ?
>
> Do you have file.h in the HEADERS list ?
Yes, it is there.

> Could be that we have some confusion with moc'ing .h vs. .cpp files here,
> though. Don't recall the initial posters intention.
There are two ways to handle moc files (having file.cpp and file.h) :
1) Create moc_file.cpp, compile it separatly, link all together.
2) Create file.moc which is inluded in file.cpp (#include "file.moc") and 
compile and link as usuall.
In my project, using qmake, I'm using the first one and I want to use the 
second one (the second one is the 'default' one when doing KDE apps).

Thanks.
- -- 
Pupeno: pupeno@pupeno.com
http://www.pupeno.com
- ---
Help the hungry children of Argentina,
please go to (and make it your homepage):
http://www.porloschicos.com/servlet/PorLosChicos?comando=donar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+t++5Lr8z5XzmSDQRAqKwAJ9QV7Sczv6vv7iKERMPfKqgW3SWigCcCSCL
bAPRgKGKBWj+aOnl4pd5hOY=
=0xbQ
-----END PGP SIGNATURE-----