Quantcast

question about wxprec.h

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

question about wxprec.h

Marcin Wojdyr-3
Hi,
minimal and other samples have this complicated sequence:

#include "wx/wxprec.h"
#ifdef __BORLANDC__
    #pragma hdrstop
#endif
#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

Is it safe to just write
#include <wx/wx.h>
?
Are PCH used in such a case?

Marcin

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr/
_______________________________________________
wx-dev mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question about wxprec.h

Tim Stahlhut-5
Marcin Wojdyr wrote:

> Hi,
> minimal and other samples have this complicated sequence:
>
> #include "wx/wxprec.h"
> #ifdef __BORLANDC__
>     #pragma hdrstop
> #endif
> #ifndef WX_PRECOMP
>     #include "wx/wx.h"
> #endif
>
> Is it safe to just write
> #include <wx/wx.h>
> ?
> Are PCH used in such a case?
>
> Marcin
>

The answer is Compiler dependent; I am guessing the wxWidgets Team does
it in a way that works with the largest number of Compilers.

Tim S


_______________________________________________
wx-dev mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question about wxprec.h

Vadim Zeitlin-4
In reply to this post by Marcin Wojdyr-3
On Wed, 15 Apr 2009 19:27:10 -0500 Marcin Wojdyr <[hidden email]> wrote:

MW> minimal and other samples have this complicated sequence:
MW>
MW> #include "wx/wxprec.h"
MW> #ifdef __BORLANDC__
MW>     #pragma hdrstop
MW> #endif
MW> #ifndef WX_PRECOMP
MW>     #include "wx/wx.h"
MW> #endif
MW>
MW> Is it safe to just write
MW> #include <wx/wx.h>
MW> ?

 It is if you are going to either never use PCH or always use them.

MW> Are PCH used in such a case?

 This depends on the switches you use on your compiler command line. E.g.
with g++ you need to create wx/wx.gch first and then ensure it's in the
include path before wx/wx.h.

 The complications above are necessary if

a) you use Borland which apparently requires this pragma
b) you want to be able to build both with and without WX_PRECOMP (as is
   necessary for the samples as not all compilers support PCH)

 Regards,
VZ

_______________________________________________
wx-dev mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

attachment0 (202 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question about wxprec.h

Marcin Wojdyr-3
On Thu, Apr 16, 2009 at 07:41, Vadim Zeitlin <[hidden email]> wrote:

> On Wed, 15 Apr 2009 19:27:10 -0500 Marcin Wojdyr <[hidden email]> wrote:
>
> MW> minimal and other samples have this complicated sequence:
> MW>
> MW> #include "wx/wxprec.h"
> MW> #ifdef __BORLANDC__
> MW>     #pragma hdrstop
> MW> #endif
> MW> #ifndef WX_PRECOMP
> MW>     #include "wx/wx.h"
> MW> #endif
> MW>
> MW> Is it safe to just write
> MW> #include <wx/wx.h>
> MW> ?
>
>  It is if you are going to either never use PCH or always use them.

I'm not sure if I understand. Do you mean that in one project wxprec.h
should be always included or not?


> MW> Are PCH used in such a case?
>
>  This depends on the switches you use on your compiler command line. E.g.
> with g++ you need to create wx/wx.gch first and then ensure it's in the
> include path before wx/wx.h.

Is it done when one installs wx with the standard ./configure && make
install sequence?

>  The complications above are necessary if
>
> a) you use Borland which apparently requires this pragma
> b) you want to be able to build both with and without WX_PRECOMP (as is
>   necessary for the samples as not all compilers support PCH)

Maybe that's a silly question, but is it possible to just put this
sequence into a header file and include just one file?

Thanks,
Marcin

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr/
_______________________________________________
wx-dev mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re[2]: question about wxprec.h

Vadim Zeitlin-4
On Thu, 16 Apr 2009 11:41:11 -0500 Marcin Wojdyr <[hidden email]> wrote:

MW> On Thu, Apr 16, 2009 at 07:41, Vadim Zeitlin <[hidden email]> wrote:
MW> > On Wed, 15 Apr 2009 19:27:10 -0500 Marcin Wojdyr <[hidden email]> wrote:
MW> >
MW> > MW> Is it safe to just write
MW> > MW> #include <wx/wx.h>
MW> > MW> ?
MW> >
MW> >  It is if you are going to either never use PCH or always use them.
MW>
MW> I'm not sure if I understand. Do you mean that in one project wxprec.h
MW> should be always included or not?

 I was answering your question above, i.e. yes, it is safe to just write
#include <wx/wx.h> if you don't want to be able to build both with and
without PCH.

MW> > MW> Are PCH used in such a case?
MW> >
MW> >  This depends on the switches you use on your compiler command line. E.g.
MW> > with g++ you need to create wx/wx.gch first and then ensure it's in the
MW> > include path before wx/wx.h.
MW>
MW> Is it done when one installs wx with the standard ./configure && make
MW> install sequence?

 Nothing is done for the build of your applications. You still need to set
up your makefiles/whatever to either use PCH or not use them.

MW> >  The complications above are necessary if
MW> >
MW> > a) you use Borland which apparently requires this pragma
MW> > b) you want to be able to build both with and without WX_PRECOMP (as is
MW> >   necessary for the samples as not all compilers support PCH)
MW>
MW> Maybe that's a silly question, but is it possible to just put this
MW> sequence into a header file and include just one file?

 No, "#pragma hdrstop" can't be inside a header.

 Regards,
VZ

_______________________________________________
wx-dev mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

attachment0 (202 bytes) Download Attachment
Loading...