| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
Hi,
I have included a "moc" file in the main.cpp file and I want to know is it possible to use precompiled header for "moc" file. Sine we write:
#include "....moc", means that it is somehow a header file, and now I want to create a precompiled header from it. I want to do that in .NET 2003.
Thanks,
Mahmood NT
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
--
[ signature omitted ]
On torsdag den 3. Januar 2008, Mahmood NT wrote: > Hi, > I have included a "moc" file in the main.cpp file and I want to know is it > possible to use precompiled header for "moc" file. Sine we write: > > #include "....moc", means that it is somehow a header file, and now I want > to create a precompiled header from it. I want to do that in .NET 2003. You have misunderstood precompiled headers. They are only for files that do not change, and a generated moc file is not in this category. You can't do it, and the reason is that you shouldn't. Bo. -- [ signature omitted ]
well, probably the author means if that file is not a generated file. As I remember in qt3 I saw samples that were including moc files, those moc files are not necessary to be generated you can write them if you understand what you do. That would be the case for some custom building tools. I never user myself precompiled headers with QT since time building is not an issue for me in my conditions. As far as I know there is a switch that enables this when you compile QT itself. See what this gives you, check the docs for this. Bo Thorsen wrote: > On torsdag den 3. Januar 2008, Mahmood NT wrote: > >> Hi, >> I have included a "moc" file in the main.cpp file and I want to know is it >> possible to use precompiled header for "moc" file. Sine we write: >> >> #include "....moc", means that it is somehow a header file, and now I want >> to create a precompiled header from it. I want to do that in .NET 2003. >> > > You have misunderstood precompiled headers. They are only for files that do > not change, and a generated moc file is not in this category. > > You can't do it, and the reason is that you shouldn't. > > Bo. > > -- [ signature omitted ]
>You have misunderstood precompiled headers. They are only for files that do >not change, and a generated moc file is not in this category. I can not understand... I think my moc file does not change. Shall I post my moc file? Regards, Mahmood NT ----- Original Message ---- From: Bo Thorsen <bo@xxxxxxxxxxxxxxxxxxxxx> To: qt-interest@xxxxxxxxxxxxx Sent: Thursday, January 3, 2008 11:53:11 AM Subject: Re: creating precompiled header for MOC file On torsdag den 3. Januar 2008, Mahmood NT wrote: > Hi, > I have included a "moc" file in the main.cpp file and I want to know is it > possible to use precompiled header for "moc" file. Sine we write: > > #include "....moc", means that it is somehow a header file, and now I want > to create a precompiled header from it. I want to do that in .NET 2003. You have misunderstood precompiled headers. They are only for files that do not change, and a generated moc file is not in this category. You can't do it, and the reason is that you shouldn't. Bo. Mahmood NT ----- Original Message ---- From: Bo Thorsen <bo@xxxxxxxxxxxxxxxxxxxxx> To: qt-interest@xxxxxxxxxxxxx Sent: Thursday, January 3, 2008 11:53:11 AM Subject: Re: creating precompiled header for MOC file On torsdag den 3. Januar 2008, Mahmood NT wrote: > Hi, > I have included a "moc" file in the main.cpp file and I want to know is it > possible to use precompiled header for "moc" file. Sine we write: > > #include "....moc", means that it is somehow a header file, and now I want > to create a precompiled header from it. I want to do that in .NET 2003. You have misunderstood precompiled headers. They are only for files that do not change, and a generated moc file is not in this category. You can't do it, and the reason is that you shouldn't. Bo. -- [ signature omitted ]
> well, probably the author means if that file is not a generated file. can you explain more? maybe my file fit this. How can I check it? >As far as I know there is a switch that enables this when you compile QT >itself. >See what this gives you, check the docs for this. if you know the link to that doc, I will be very thankful. Otherwise please give me a cue or some keywords so that I will search for them. Reagrds, Mahmood NT Mahmood NT ----- Original Message ---- From: Yong Taro <yanicher@xxxxxxxxx> To: qt-interest@xxxxxxxxxxxxx Sent: Thursday, January 3, 2008 12:13:30 PM Subject: Re: creating precompiled header for MOC file well, probably the author means if that file is not a generated file. As I remember in qt3 I saw samples that were including moc files, those moc files are not necessary to be generated you can write them if you understand what you do. That would be the case for some custom building tools. I never user myself precompiled headers with QT since time building is not an issue for me in my conditions. As far as I know there is a switch that enables this when you compile QT itself. See what this gives you, check the docs for this. Bo Thorsen wrote: > On torsdag den 3. Januar 2008, Mahmood NT wrote: > >> Hi, >> I have included a "moc" file in the main.cpp file and I want to know is it >> possible to use precompiled header for "moc" file. Sine we write: >> >> #include "....moc", means that it is somehow a header file, and now I want >> to create a precompiled header from it. I want to do that in .NET 2003. >> > > You have misunderstood precompiled headers. They are only for files that do > not change, and a generated moc file is not in this category. > > You can't do it, and the reason is that you shouldn't. > > Bo. > > -- [ signature omitted ]
Mahmood NT wrote: >> well, probably the author means if that file is not a generated file. > >can you explain more? maybe my file fit this. How can I check it? It's changed when your header changes. But since it's included in a single place, precompiling it is unnecessary. What's more, precompiling it will probably do the *wrong* thing. Here's why: Moc's output is a C++ source file. It contains entire functions and declarations. It must be compiled EXACTLY ONCE into your project, or you'll have broken output or linker errors. What's more, you don't have to #include it, in most cases. You only *have* to include it if you're using Q_PRIVATE_SLOT -- which you shouldn't, because it's not a documented macro. So, you shouldn't treat moc's outputs as header files. You should treat them as source (.cpp) files. Do you precompile your .cpp? >>As far as I know there is a switch that enables this when you compile >> QT itself. >>See what this gives you, check the docs for this. > >if you know the link to that doc, I will be very thankful. Otherwise > please give me a cue or some keywords so that I will search for them. The argument "-pch" to configure. -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
>So, you shouldn't treat moc's outputs as header files. You should treat >them as source (.cpp) files. Do you precompile your .cpp? thanks for that. I think I now understand... Mahmood NT ----- Original Message ---- From: Thiago Macieira <thiago.macieira@xxxxxxxxxxxxx> To: qt-interest@xxxxxxxxxxxxx Sent: Thursday, January 3, 2008 11:06:33 PM Subject: Re: creating precompiled header for MOC file Mahmood NT wrote: >> well, probably the author means if that file is not a generated file. > >can you explain more? maybe my file fit this. How can I check it? It's changed when your header changes. But since it's included in a single place, precompiling it is unnecessary. What's more, precompiling it will probably do the *wrong* thing. Here's why: Moc's output is a C++ source file. It contains entire functions and declarations. It must be compiled EXACTLY ONCE into your project, or you'll have broken output or linker errors. What's more, you don't have to #include it, in most cases. You only *have* to include it if you're using Q_PRIVATE_SLOT -- which you shouldn't, because it's not a documented macro. So, you shouldn't treat moc's outputs as header files. You should treat them as source (.cpp) files. Do you precompile your .cpp? >>As far as I know there is a switch that enables this when you compile >> QT itself. >>See what this gives you, check the docs for this. > >if you know the link to that doc, I will be very thankful. Otherwise > please give me a cue or some keywords so that I will search for them. The argument "-pch" to configure. -- [ signature omitted ]